Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jan 1996 08:09:27 GMT
From:      "Jay L. West" <jlwest@tseinc.com>
To:        freebsd-questions@freebsd.org
Subject:   parallel logon question (gestur@islandia.is)
Message-ID:  <199601040809.IAA03223@bsd.tseinc.com>

next in thread | raw e-mail | index | archive | help
gestur@islandia.is asked about preventing parallel logons. Here's the
solution that we use here. All our customers dial in via iij-PPP. When we
create their account the logon shell is set to /usr/local/bin/ppplogin. The
idea is that the ppplogin script will kick off iijppp. Our ppplogin is:

#!/bin/sh -
if [`who | cut -d\  -f1 | wc -l` -gt 1]; then
   echo Already logged on.
   exit
fi
/usr/sbin/ppp -direct `tty|cut -d/ -f3`

Things to note -- there are TWO spaces after the -d\ in the second line.
There's probably a better way to indicate a space delimiter, but I'm no
script programmer. After the wc is a -letter not -number and after the -gt
is a number not a letter. The last line starts ppp with a label of the
current tty port. This is because we pseudo-dynamically assign ipa's (per
tty rather than per connect). As a result your
final line that starts ppp may vary. Use what you've got working already there.

This works great for ppp. For shell accounts, you could use the same logic
above but
put it in the skeleton .profile or $HOME/.profile (or /etc/profile if
FreeBSD uses that). The other solution I saw posted here suggested a crontab
entry, but your users might find it more palatable to not get a second login
rather than getting it and then being kicked off.

Hope this helps!
Jay L. West




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199601040809.IAA03223>