ITEM: V7465L
How to limit the number of simultaneous user logins.
NOTE: The following code is sample only and is provided AS-IS.
The incorporation of the following code into a user's
system and maintenance of this code is the responsibility
of the user. IBM does not provide technical support nor
provide maintenance for the following code.
Simultaneous user logins can be limited as follows:
1. Write the following script called: /usr/bin/loglimit
\#!/bin/ksh
logsessions=`who | grep $1 | awk '{print $1}' | wc -l`
if [ $logsessions -lt 1 ]
then
exit 0
else
echo "permission denied:
echo "you are permitted $logsessions login sessions"
exit 1
fi
Make sure the script is owned by root.
Also run: 'chmod 744 /usr/bin/loglimit'.
2. Edit /etc/security/login.cfg as follows:
vi /etc/security/login.cfg
you should have two lines:
* auth_method:
* program =
you will need to change it to look as follows:
auth_method:
program = /usr/bin/loglimit
3. Edit /etc/security/user:
default:
admin = false
login = true
su = true
daemon = true
rlogin = true
sugroups = ALL
ttys = ALL
auth1 = SYSTEM
auth2 = NONE
tpath = nosak
umask = 022
expires = 0
root:
admin = true
user1:
admin = false
Above is an example of what the file currently
looks like. You will need to change the auth1
line. This can be done in under default or
for individual users.
default:
auth1 = SYSTEM, auth_method
This will effect everyone on the system.
If you want to do this, you could edit the script so that
it is checking for certain users that you do not want
to be effected.
user1:
auth1 = SYSTEM, auth_method
user2:
auth1 = SYSTEM, auth_method
user3:
This will cause user1 and user2 to be restricted,
but not user3.
Support Line: How to limit the number of simultaneous user logins. ITEM: V7465L
Dated: July 1995 Category: N/A
This HTML file was generated 99/06/24~13:30:34
Comments or suggestions?
Contact us