Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Oct 1997 02:08:40 -0600 (CST)
From:      "Matthew D. Fuller" <fullermd@futuresouth.com>
To:        R Nelson <rjn103s@mgr3.k12.mo.us>
Cc:        support@FreeBSD.ORG
Subject:   Re: Checking for concurrent logins
Message-ID:  <Pine.BSF.3.96.971031020223.22387D-100000@shell.futuresouth.com>
In-Reply-To: <B0000056463@mgr3_serverx.mgr3.k12.mo.us>

index | next in thread | previous in thread | raw e-mail

On Tue, 28 Oct 1997, R Nelson wrote:

> I have searched the mailing lists and had no luck about looking for a simple
> script I could execute when a user logs on to check to see if they are
> already logged on and if they are to disable that account or at least notify
> the administrator.  
Ouch.
I don't think this will work as just a script; it'd have to be suid, which
a script can't be.  It might have to call a perl module or something to do
the editing of the password file.
I don't know that much perl, but what you'd have to do is:
a) grep/sed/awk through the output of w or who
b) if they're there, mail admin and/or call the perl module to change
their login shell to /bin/false.

a) should be easy with who | grep (username), and checking the return
value of grep.
b) mailing is of course, a simple matter of mail root -s $USER multiple
logins
b2) adding /bin/false as login shell is going to be tricky because you'll
have to be careful not to thrash the passwd file completely.

Just to add my $.02, I think disabling the account automatically in this
sort of case is a Bad Idea.  I've had cases where I've lost my connection,
etc, and my previous session is still active when I get back on.  Perhaps
mailing the admin and mailing the user in question with a warning and
request for explanation would be a good idea.  Then again, I don't know
your setup and environment, so I can't really judge.

> 
> Thanks in advance!!
> Golf and FreeBSD are 2 of the nice things in life;)
> 


*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
|       FreeBSD; the way computers were meant to be       |
* "The only reason I'm burning my candle at both ends, is *
| that I haven't figured out how to light the middle yet."|
*    fullermd@futuresouth.com      :-}  MAtthew Fuller    *
|      http://keystone.westminster.edu/~fullermd          |
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*




help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.971031020223.22387D-100000>