> One simple way is to write a script
We'll depending on how heavy of a system load, the script may
reduce system performance because it has to do one extra thing
when logging on. The best way to take care of this problem is
to set environment variables for the kernel.
Since this question has come up in comp.unix.solaris before, I have
included
two fixes for similar questions that address:
o expand or limit the number of pseudo-ttys (which in turn limits the
number of maximum telnet sessions open on a system)
o limit the user's processes to xxx (listed after the 3.41 entry below)
For example on solaris 2.x, you can limit the number of pseudo ttys
which would in turn limit the number of users that could login. The
following
specifies how to allocate more than 48 pseudo-ttys, but lowering the
number
would reduce the number of pseudo-ttys.
The solaris FAQ says:
3.41) How can I have more than 48 pseudo-ttys?
Edit /etc/system and add the following line:
* System V pseudo terminals
set pt_cnt = <num>
Halt the system and boot -r.
You can essentially have as many as you like, but you'll probably
run into some other limit somewhere. More than 3000 are supported.
Solaris 2.6 and earlier have telnet/rlogin daemons that do not
support more than 3844 sessions each. That restriction is lifted
in Solaris 7.
Some die-hard system administrator myths as well as some Sun
documentation claim that you have to increased "sad_cnt", "sadcnt"
or "nautopush" when adding ptys. There is no truth in this.
In the unlikely event that you run out of BSD-style ptys,
you can increase them as well. The maximum here is currently
176 for pty[p-z][0-9a-f]. This is somewhat less that the BSD
maximum of 256 limited by 8 bit device minor numbers.
BSD ttys are awkward to use and all programs I found support SYSV
ptys without trouble.
* You don't need this. Increasing this value too much usually
* just wastes memory.
* BSD applications never support more than 256 ptys.
* Solaris 2.x supports no more than 176 BSD ptys.
set npty = <num>
But you're not there yet, you also need to edit /etc/iu.ap and
substitute the new value of "npty-1" for the "47" on the following
set npty = <num>
But you're not there yet, you also need to edit /etc/iu.ap and
substitute the new value of "npty-1" for the "47" on the following
line, in case you do increase the number of BSD style ptys.
ptsl 0 47 ldterm ttcompat
Halt the system and boot -r.
--- end of excerpt from the FAQ
Questions marked with a * or + have been changed or added since
the FAQ was last posted
The most recently posted version of the FAQ is available from
<http://www.wins.uva.nl/pub/solaris/solaris2/>
If you are interested in limiting the number of maximum sessions that
a user can have, instead of writing a script that could slow down your
system under heavy-loads or extend login time, use maxuprc (under
solaris).
Is there a Solaris 2.4 kernel tuning parameter that stop unfriendly
programs from taking over a system?
Q: Is there a Solaris 2.4 kernel tuning parameter (like maxuprc) that
would allow sysadmins to stop unfriendly programs from taking over a
system?
The problem we have sometimes seen is a poorly written program forking
off infinite copies of itself until the machine dies or hits its process
limit. We
want to be able to limit a user's total to, say, 100 processes.
Is this possible under Solaris 2.4?
--Lance Nakata, Stanford University
A: The same maxuprc variable does this for you in Solaris 2.X
set maxuprc=100 in /etc/system and reboot
(From http://www.sunworld.com/common/cockcroft.letters.html)
Cheers!
rk