Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

limit number of logins per user 3

Status
Not open for further replies.

andyraff

Technical User
Feb 20, 2001
10
GB
I need to limit certain users on the amount of sessions that that can use
 
AIX doesn't have individual login controls to do that, but because it has an extensible login validation architecture you can create a script and set it up in the auth1 attribute for the users.

Try searching the help system for the file /etc/security/login.cfg... I've set up login controls by IP using a script and some little text files.

I hope it works...
 
andyraff,

You need to put something ( thoroughly tested) in /etc/profile. Use the count variable to limit the number of sessions per user...

something like

count=`who | grep $LOGIN | wc -l`
if [ $count >= 2 ]
then
echo "you are already logged in elsewhere. Please log out of there
and re-login"
sleep 10
exit 0
fi

Cheers

PSD
HACMP Specialist
 
A brief version of the example from "The AIX Survival Guide" by Andreas Siegert, pub. Addison-Wesley might clear this up:

Add a script to /etc/security, myscript
-----------------

#!/usr/bin/ksh
trap "" 1 3 4 6 8 13 15 17 21 22 30 31
PATH=/usr/bin
MAX=2
NUM_LOGS=`who|egrep "^$1"|wc -l`
test "$NUM_LOGS" -lt "$MAX" && exit 0
exit 1

---------------------

now add the following to /etc/security/login.cfg

MAXRULE:
program = /etc/security/myscript

then edit /etc/security/user

for each user that you want to apply this rule(or default):

username:
auth1 = SYSTEM,MAXRULE

HTH

-Bowie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top