1825720 Members
3350 Online
109686 Solutions
New Discussion

Control the telnet

 
peterchu
Super Advisor

Control the telnet

In my system , all user login are via telnet , we have control that only allow max. 300
telnet session in the system , now if I want to keep the max. no of telnet unchange (300) ,
but three specific users ( eg. userA , userB ,userC ) not count into this 300 session , is
it possible ?

for example ,

there are 300 user are in the system currently , if userA , userB & userC are also in the
system , the general user can still login until the no. of telnet reach to 303 ( as these
three users not count into the 300 , in short , the login of these specific users are
separate from general user ,

I really need help on that , but not sure whether I have mention about it , please let me
if not clear , thx in advance.
6 REPLIES 6
Geoff Wild
Honored Contributor

Re: Control the telnet

Sorry, I don't think this is possible....as this is a kernel parameter....

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Sundar_7
Honored Contributor

Re: Control the telnet

nah, I dont think that is possible. These are hard limit for the kernel structures.
Learn What to do ,How to do and more importantly When to do ?
Sanjay Yugal Kishore Ha
Frequent Advisor

Re: Control the telnet

Controlling the number of telnet sessions? Not possible.
However, you looking to restrict users A,B and C on when they can login to the system based on the rule of number of users already logged in.

Perhaps you can try 'Set Authorised Login Times' for these specific users. The flip side, the system has to be converted to a trusted system.

Hope this helps.

Cheers,
Sanjay
Dying is the last thing that I will do.
Arunvijai_4
Honored Contributor

Re: Control the telnet

Hello,

This is not a dynamic variable as far as i know, so, it cant be possible.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Luk Vandenbussche
Honored Contributor

Re: Control the telnet

Hi,

I think, the easiest way is to do al little test in the .profile or .login script

if [ `who | wc -l` -gt > 300 ]
then
exit
fi

Off course this must be customize to evaluate also userA, userB & userC
Steven E. Protter
Exalted Contributor

Re: Control the telnet

Shalom,

You can do this.

Set the limit higher on the system in the kernel.

Use /etc/profile to check the user count and reject users greater than 300 except for the users you wish to be invincible.




ucount=$(ps -ef | grep telnetd |wc -l)
# or use Bill Hassell's code.
# Now you have your count.
letlog=0
if [ $ucount -ge 300 ]
then
if [ "$LOGNAME" == userA ]
then
letlog=0
else
letlog=1
fi
fi
if [ $letlog -eq 0 ]
then
echo "do nothing, letting special user log in"
else
echo "Too many users, try again..."
exit 1
fi

All you need to do is change the if statement for userA into a list, perhaps a for loop to allow all good users.

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