only one user logged per session/time

Artyom V. Viklenko artem at mipk.kharkiv.edu
Fri Sep 12 00:08:38 PDT 2003


Something similar can be placed into system-wide profiles such as
/etc/profile or /etc/csh.login. So, there will be no need to read passwd
file and NIS-aware systems will work fine. And it will be transparent
in terms of creating new users - no need separate login class.
Also, there is no problem with rewritting environment variables (which
some times can be set "readonly" due to security considerations).

Lanny Godsey wrote:
>
> 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
>
> -----------------------------------------------------------------
>

-- 
       Sincerely yours,
                         Artyom V. Viklenko.
======================================================
System Administrator            artem at mipk.kharkiv.edu
------------------------------------------------------
IIAT NTU "KhPI" 21, Frunze Str., Kharkov Ukraine 61002
Phone: +380 (572) 400026        Fax: +380 (572) 474062
======================================================



More information about the freebsd-isp mailing list