Logging a User Off

David Harrison dmh at sq.sq.com
Wed Sep 12 21:08:52 AEST 1990


In article <1990Sep11.173008.274 at mccc.uucp> pjh at mccc.uucp (Pete Holsberg) 
writes:
>However, I would like to be able to terminate the login process ..
>BUT, simply executing "exit" [in /etc/profile] doesn't abort the 
>login; it aborts /etc/profile!  What can I execute to terminate 
>the login of a user  ...

"kill -9 0" has worked for me in Sys III, SysV.3, and now SunOS.

Also:
>For reasons that are beyond the scope of this question, all new logins
>on one of my systems (3B2.400 SVR3.1) get no initial password.  I've
>written a little script that I put into /etc/profile.  It examines the
>password field of /etc/passwd for the user logging in and runs the
>passwd program if the password field is empty.  

Beware: the passwd(1) command tries to keep two users from simultaneously
editing the password file by creating a tmp file in /etc: if that file
already exists passwd refuses to run for a second user.  This can
lead to a race condition if two users invoke passwd at almost the
same time, and under suitable conditions you can end up with no
password file at all!  I used to have my 1400 undergraduates choose
their own passwords, and ended up surrounding passwd with a wrapper
that put up a semaphore to avoid the race; I don't know how we would 
do it under SunOS.  (We abandoned the scheme because too many students 
forgot what they had chosen; now a much smaller percentage of them lose 
the paper we give them with the password on it. :-{ )
--
David Harrison, Dept. of Physics, Univ. of Toronto, 
harrison at faraday.physics.utoronto,ca
..uunet!utgpu!utfyzx!harrison

(Just reading the news at SoftQuad; not affiliated with them and 
they ain't responsible for me at all.)



More information about the Comp.unix.admin mailing list