1832331 Members
3051 Online
110041 Solutions
New Discussion

Limiting users logged in

 
TriggerOfSunderland
Occasional Contributor

Limiting users logged in

How do i go about limiting the number of users logged into my unix server to 99?

Regards
13 REPLIES 13
Adam W.
Valued Contributor

Re: Limiting users logged in

You can use

kmtune |grep pty
npty 200 - 200


or use

# sysdef |grep pty
npty 200


These are the default settings but if you alter the # from 200 to... whatever that will set the limit. Man kmtune or sysdef for more options.
There are two types of people in the world, Marines and those who wish they were.
sreekanthtm
Trusted Contributor

Re: Limiting users logged in

To check the current value of maxusers

# kmtune -q maxusers

To change the value of maxusers

# kmtune -s maxusers=99

If kmtune is not working please provide the HPUX version running in ur server.

# uname -a


Rgds
Sreekanth
Adam W.
Valued Contributor

Re: Limiting users logged in

I forgot to add that the -s option is what would be used with kmtune to set max users. Again Man page for the command tells everything.
There are two types of people in the world, Marines and those who wish they were.
Venkatesh BL
Honored Contributor

Re: Limiting users logged in

Yes, tune 'maxusers'.

'npty' is for pseudo-terminals. Note that one user can invoke many pseudo-terminal connections.
TriggerOfSunderland
Occasional Contributor

Re: Limiting users logged in

maxusers doesn't seem to work, and it doesn't appear in SAM under the Kernel tunables.
The version i am running is: HP-UX flgu02 B.11.23 U 9000/800 3237201803 unlimited-user license

Regards
sreekanthtm
Trusted Contributor

Re: Limiting users logged in

you may need to use the full path.

# /usr/sbin/kmtune.

You can use # whereis to get the absolute path of an executable in HPUX

Need not use SAM.

Rgds
Sreekanth
Adam W.
Valued Contributor

Re: Limiting users logged in

sreekanthtm, excellent reference I LOVE the whereis command.
There are two types of people in the world, Marines and those who wish they were.
Adam W.
Valued Contributor

Re: Limiting users logged in

and trigger a big word of advice, even though SAM does have its uses (although not very often) SAM is very limited and not a very good reference to use unless you have no choise. Stick with the command line unless you ABSOLUTELY HAVE to use SAm. (Just some advice, take it as you will.)
There are two types of people in the world, Marines and those who wish they were.

Re: Limiting users logged in

You won't find kmtune anywhere on a 11.23 box. Try kctune instead.

I'm not sure the maxusers parameter even exists in 11.23... and I don't think setting it would prevent more than 100 people from logging in anyway

How do your users login to the system? At a shell prompt?

Why do you need to stop the 100th person from logging in?

HTH

Duncan

I am an HPE Employee
Accept or Kudo
TriggerOfSunderland
Occasional Contributor

Re: Limiting users logged in

Duncan,

You're right maxusers isn't an option.

I need to limit the number of users because rather than put a user limit on the 10 or so progress databases we use for licencing, we want to put a limit on the server itself and have unlimited user limits on each of the databases creating a 'pool' of licences, if you know what i mean.

Regards

Re: Limiting users logged in

and do all your progess database users connect through a UNIX shell prompt? This seems unlikely to me...

HTH

Duncan

I am an HPE Employee
Accept or Kudo
TriggerOfSunderland
Occasional Contributor

Re: Limiting users logged in

Yeah, all users connect via telnet and open a shell prompt.
Victor Fridyev
Honored Contributor

Re: Limiting users logged in

Hi,

You can add some test into /etc/profile.

Something like that:
if [ $(who | grep -v root| sort -u |wc -l) -gt 99 ]; then
exit
#You can add here a mail to the user
fi
I don't know which type of license you have, so you can remove sort -u
HTH
Entities are not to be multiplied beyond necessity - RTFM