Date: Thu, 11 Sep 2003 12:52:43 -0700 (PDT) From: Lanny Godsey <lannygodsey@yahoo.com> To: freebsd-isp@freebsd.org Subject: Re: only one user logged per session/time Message-ID: <20030911195243.18692.qmail@web20708.mail.yahoo.com> In-Reply-To: <63396.148.243.211.1.1063304771.squirrel@mail.unixmexico.com>
next in thread | previous in thread | raw e-mail | index | archive | help
(my first reply was direct and not to list, someone else may use this also) This isn't exactly what you want, but you may want to look at /etc/login.conf and limit the # of processes, memory, and files a user may have open. add the following to /etc/login.conf, then run cap_mkdb /etc/login.conf onelogin:\ :tc=default:\ :shell=/usr/local/bin/onelogin: place the following into /usr/local/bin/onelogin ------------------------------------------------------ #!/bin/sh # set the limit here. CNT=1 MYUID=`id -u` DEVS=`find /dev -user $MYUID | wc -l` if [ $DEVS -gt $CNT ]; then echo Sorry, this system has limited you to only $CNT simultanious connections. exit fi # read users shell from passwd (this won't work with nis) MYSHELL=`grep ^$USER: /etc/passwd | cut -d : -f 7` # some /bin/sh variants may not allow to write to $SHELL SHELL=$MYSHELL # set the shell you want here exec $MYSHELL ----------------------------------------------------------------- pw usermod james -L onelogin now james should be limited to 1 login. you can also change CNT=2 to limit to 2 etc... I just wrote this when I got your email so be sure to test first, if you have any questions let me know. --- nbari@unixmexico.com wrote: > Hello, I have a server with ssh access to the users, but how can I > allow > only one user to be logged at a time. > > I dont want to allow a user to login multiple times, I just want the > user > to login onece and if he try to open a second coneection, refuse the > user > until the session is over or the user is allready loged. > > > thanks in advance.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030911195243.18692.qmail>