Operating System - HP-UX
1837770 Members
4553 Online
110119 Solutions
New Discussion

maximum simultaneous logins

 
SOLVED
Go to solution
Alejandro Anguiano
Occasional Advisor

maximum simultaneous logins

I need to configure the system with the limit of simultaneous logins for some users, how can i do it?

Txs
7 REPLIES 7
Karthik S S
Honored Contributor

Re: maximum simultaneous logins

Best way is to call a script from /etc/profile which will check the number of times that a user logged in using who command and if it exceeds the defined limit logout that user.

-Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
Alejandro Anguiano
Occasional Advisor

Re: maximum simultaneous logins

tvm
do you have an script example
Paula J Frazer-Campbell
Honored Contributor
Solution

Re: maximum simultaneous logins

Hi

this should help:-

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=52512


Paula
If you can spell SysAdmin then you is one - anon
Hein van den Heuvel
Honored Contributor

Re: maximum simultaneous logins


If you try 'limit login' as search string in the forum header, you'll get several useful earlier answers. Notably:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=98655

hth,
Hein.
Umapathy S
Honored Contributor

Re: maximum simultaneous logins

Try this.
I havent tested this.

----
no_logins=`who|grep $LOGNAME|wc -l`
if [[ $no_logins -gt 4 ]]
then
echo "you have exceeded the limit"
exit
fi
-----
replace the 4 with the number you want

HTH,
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Karthik S S
Honored Contributor

Re: maximum simultaneous logins

If you are using KSH then add the following lines in /etc/profile,

MAXINST=5
CURRINST=$(who | awk -F " " '{print $1 }' | grep `whoami` |wc -l)
if [ $CURRINST -gt $MAXINST ]
then
echo "You have exceeded the login limit"
exit
fi

You can also customize the MAXINST variable for individual users by adding these lines in .profile of individual users.

-Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
Bill Hassell
Honored Contributor

Re: maximum simultaneous logins

If you want to limit every user (except root) to a maximum number of logins, use the /etc/default/security file and add the line:

NUMBER_OF_LOGINS_ALLOWED=4

and now no more than 4 logins total for every user is allowed. To have random limits based on the user ID, you'll need to use the /etc/profile and /etc/csh.login code to manage each user's limit by exiting when the limit has been exceeded. You'll likely need the patch PHCO_27721 for 11.0 and PHCO_27694 for 11.11 (both will patch the /usr/bin/login file only, and do not require a reboot)


Bill Hassell, sysadmin