Linux, samba and one logon per user.

David Collier-Brown David.Collier-Brown at
Fri Oct 27 12:07:28 GMT 2000

George Farris wrote:
| I'm setting up a lab full of users here at the college 
| and really need to be able to restrict a user to a single 
| login at any given time.  Does anyone have any thoughts or
| suggestions about this?

	Hmmn, you can do this with a preexec script,
	but you need a reliable way of detecting
	logoff, even when a PC crashes or is shut off.
	I recommend using the --with-uname option, and
root preexec close = yes
root preexec = /some/path/to/script %u
<script> ::=
	x=`last $1 | grep 'still logged in'`
	if [ "$x" != "" ] then
		echo "$1 tried to log in twice at `date`" >$LOG
		exit 1
		exit 0

	This will require your system have a way of removing
	bogus "still logged in" records from wtmp, packaged
	nicely for the lab supervisor to use, as murphy's
	law states that PC will crash mysteriously during
	the week of heaviest lab use (;-))

	Alternately, you can keep the data yourself, and have
	scripts to add users and delete users, and run the
	delete script from root postexec.

David Collier-Brown,  | Always do right. This will gratify some
185 Ellerslie Ave.,   | and astonish the rest.        -- Mark
Willowdale, Ontario   |
Work: (905) 415-2849 Home: (416) 223-8968 Email:
davecb at

More information about the samba mailing list