Operating System - HP-UX
1833784 Members
4513 Online
110063 Solutions
New Discussion

Allow user a single concurrent login

 
SOLVED
Go to solution
Martin Young
Occasional Contributor

Allow user a single concurrent login

I want to restrict a user to only be able to have a single concurrent login by telnet. Is there a system setting which will set the number of concurrent logins, or will I have to change the users login script to check if they are already logged on?
2 REPLIES 2
RAC_1
Honored Contributor
Solution

Re: Allow user a single concurrent login

What OS you are running? Depending on that you few options here.

IOrrespective of what OS your ar erunning you can put some code in /etc/profile to take care of this. Something as follows.

logname=${LOGNAME}
count = `who -u|grep "${logname}"`
if [ $count -gt "1" ]
echo "Only one login per user allowed"
exit 0
fi

If you are runninf 11.0 or upwards, you can put following entry in /etc/default/security file. (This applies only to non-root users.

NUMBER_OF_LOGINS_ALLOWED=1

Anil
There is no substitute to HARDWORK
Victor Fridyev
Honored Contributor

Re: Allow user a single concurrent login

Hi,

Additional hint:
if [ $(last $LOGNAME|grep "logged in" 1>/dev/null) -gt 1 ]; then
exit
else
:
fi
Just take into account that this and previous tests don't work if user logs in via
su - username

Good luck
Entities are not to be multiplied beyond necessity - RTFM