From owner-freebsd-isp@FreeBSD.ORG Thu Sep 11 12:52:44 2003 Return-Path: Delivered-To: freebsd-isp@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BDB8316A4BF for ; Thu, 11 Sep 2003 12:52:44 -0700 (PDT) Received: from web20708.mail.yahoo.com (web20708.mail.yahoo.com [216.136.226.181]) by mx1.FreeBSD.org (Postfix) with SMTP id 1CE7D43FFD for ; Thu, 11 Sep 2003 12:52:44 -0700 (PDT) (envelope-from lannygodsey@yahoo.com) Message-ID: <20030911195243.18692.qmail@web20708.mail.yahoo.com> Received: from [63.168.117.22] by web20708.mail.yahoo.com via HTTP; Thu, 11 Sep 2003 12:52:43 PDT Date: Thu, 11 Sep 2003 12:52:43 -0700 (PDT) From: Lanny Godsey To: freebsd-isp@freebsd.org In-Reply-To: <63396.148.243.211.1.1063304771.squirrel@mail.unixmexico.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: only one user logged per session/time X-BeenThere: freebsd-isp@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: lannygodsey@yahoo.com List-Id: Internet Services Providers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Sep 2003 19:52:44 -0000 (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.