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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I stop a user from having more than 2 logins ?

Status
Not open for further replies.

spitfire1500

IS-IT--Management
Jun 27, 2001
2
0
0
GB
I need to restrict all application users to having no more than to active sessions.

Any suggestions folks ?
 
You need a few lines of code in the system profile. I haven't got my examples to hand (it was a few years ago now), but I'm sure someone will post something soon ...


One by one, the penguins steal my sanity. X-)

 
This should work (though there's probably a better way...)

add in /etc/profile:

LOGNAME=`/usr/ucb/whoami`
SES=`who | grep $LOGNAME | wc -l`
if [ $SES -gt 2 ]
then
echo "Too many sessions!"
sleep 2
exit
fi

You may also put a check to see if LOGNAME is root...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top