Operating System - HP-UX
1834458 Members
2932 Online
110067 Solutions
New Discussion

Limit number of login at same time

 
SOLVED
Go to solution
karthiknarayan
Advisor

Limit number of login at same time

I need to limit the number of login a user can do at the same time on a machine.

For example the user john can have only 3 logins to the server at the same time

how to do that???????
In Love with Life
7 REPLIES 7
inventsekar_1
Respected Contributor

Re: Limit number of login at same time

Hi karthiknarayan,

HPUX:

Modify file /etc/security/defaults

NUMBER_OF_LOGINS_ALLOWED
This parameter controls the number of simultaneous
logins allowed per user. This is applicable only for
non-root users.

NUMBER_OF_LOGINS_ALLOWED=0 Any number of logins are
allowed per user.

NUMBER_OF_LOGINS_ALLOWED=N N number of logins are
allowed per user.

Default value: NUMBER_OF_LOGINS_ALLOWED=0

man security
Be Tomorrow, Today.
Robert-Jan Goossens_1
Honored Contributor
Solution

Re: Limit number of login at same time

Hi,

You can set the max number of logins per user in the /etc/default/security file.
--
# Maximum number of logins per user. NOTE: This
# parameter only applies to the applications that
# use session management services provided by
# pam_hpsec(5) as configured in /etc/pam.conf, or
# those services that indirectly invoke the
# login(1) command.
NUMBER_OF_LOGINS_ALLOWED=3
--

Regards,
Robert-Jan
Sp4admin
Trusted Contributor

Re: Limit number of login at same time

Hello,

Use the /etc/default/security file to control logins and password restrictions.

PASSWORD_MIN_UPPER_CASE_CHARS=2
PASSWORD_MIN_LOWER_CASE_CHARS=2
PASSWORD_MIN_DIGIT_CHARS=2
PASSWORD_MIN_SPECIAL_CHARS=2
PASSWORD_HISTORY_DEPTH=10
MIN_PASSWORD_LENGTH=9

sp,
Borislav Perkov
Respected Contributor

Re: Limit number of login at same time

Hi,

You can edit .profile file for appropriate user and ad at the end of file:

[[ `who | grep john | wc -l ` -gt 3 ]] && exit

Regards,
Borislav
Steven E. Protter
Exalted Contributor

Re: Limit number of login at same time

Shalom,

I recommend Boris' code be put in /etc/profile for all users. You will need to modify it to exempt system users and application owners like Oracle.

I like better the proposed solutions using defaults.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
OldSchool
Honored Contributor

Re: Limit number of login at same time

It's going to depend on the OS. If 11.0, it's *may* require patches if they aren't already installed.

you would need PHCO_16127, PHC0_24083, and PHCO_24390. as this is an old list, they have probably been superceded.

also, see:
http://www.faqs.org/faqs/hp/hpux-faq/section-69.html
karthiknarayan
Advisor

Re: Limit number of login at same time

thnaks for the solution the /etc/security/default file worked
In Love with Life