Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TLUG Message Board



>>>>> "Jim" == Jim Schweizer <schweiz@example.com> writes:

    Jim> My problem is that some users pay for only one connection,
    Jim> but logon more than one port. Does anyone Know of a script
    Jim> that would prevent them from doing so.

To do this right you need a special login(1) that performs proper
accounting; Linux's default doesn't do it.  One dodge would be to
replace all the shells in /etc/shells with scripts like

#! /bin/sh # the _real_ /bin/sh
#
# This is the /sbin/login/bash script.
#
if [ fgrep $LOGNAME `who` ]; then
# if you don't supply this message, you're asking for trouble.
# even under Linux, a pty can hang or something.
 echo "I'm sorry, but you're only allowed to log in once;"
 echo 'you are logged in already:'
 echo
 echo '% who'
 who
 echo
 echo 'If you feel you have reached this message in error,'
 echo 'please contact the sysop at (123) 456-7890.'
 logger -i "Second login by $LOGNAME at `date`."
 exit(1)
else
 /bin/bash
fi

Should do it;
note that /etc/shells needs to be changed to point to appropriate
shells in /sbin/login (this should be on the root partition just in
case) and regular users only (not root!!) be changed from /bin/*sh to
/sbin/login/*sh in /etc/passwd.

This will cause a problem if someone logs in via internet; you'd need
to check tty lines as well.

BTW I haven't tried this so I don't know for sure it will work ;-) but 
this basic approach should.

HTH

Steve

-- 
                            Stephen J. Turnbull
Institute of Policy and Planning Sciences                    Yaseppochi-Gumi
University of Tsukuba                      http://turnbull.sk.tsukuba.ac.jp/
Tel: +81 (298) 53-5091;  Fax: 55-3849              turnbull@example.com


-----------------------------------------------------------------
a word from the sponsor will appear below
-----------------------------------------------------------------
The TLUG mailing list is proudly sponsored by TWICS - Japan's First
Public-Access Internet System.  Now offering 20,000 yen/year flat
rate Internet access with no time charges.  Full line of corporate
Internet and intranet products are available.   info@example.com
Tel: 03-3351-5977   Fax: 03-3353-6096


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links