1834798 Members
2814 Online
110070 Solutions
New Discussion

Telnet session

 
SOLVED
Go to solution
peterchu
Super Advisor

Telnet session

We have setup the max. no.of user telnet login (in our case is 70) at "/etc/xinetd.d/telnet" to control the telnet login , now, if the telnet session over 70 , then the system will not ask for login and no any message will display to the screen ( look like system hang ) , if I want when the 71th user login to the system , the user will see the existing logging user list ( eg. userid , login time , ip address of the 70 users ) , so that they know who are logging in the system , could suggest what can I do ? do I need to modify any file , could suggest how to modify it ? very thx in advance.
9 REPLIES 9
Fred Ruffet
Honored Contributor
Solution

Re: Telnet session

While you stop user at inetd level, session will not be established so user won't be able to get any info from server.

What you can do is to allow a little more (75?) and add a script in /etc/profile to display sessions and disconnect when max is reached :

sessionCount=$(who|wc -l)
if [ $sessionCount -gt 70 ] ; then
who -u
echo "Unable to login (max session reached)"
exit
fi

2 points :
. If users use windows telnet, window may close on connection end, so that they can't se the list. It may be better to use cmd, then telnet.
. By setting a max session in inetd, you will also prevent root login. That may be a bad thing for root not to be able to connect. Using the provided script for all but root with a max session to 75 will let root connect in any case.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Ravi_8
Honored Contributor

Re: Telnet session

Hi,

user will not get any info unless he/she login
never give up
peterchu
Super Advisor

Re: Telnet session

thx Fred Ruffet ,

I think you are right , but after the user get the message , the user still can login into the system , how to logout the user after they see the message and then press "enter" key ? thx.
Fred Ruffet
Honored Contributor

Re: Telnet session

"exit" command should exit the shell. If you want to pause before exit, just add a "read a" before exit.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
peterchu
Super Advisor

Re: Telnet session

thx reply , the "exit" function is ok , if I want to prompt the user to press the "space bar" to the next logging on user list screen and press "enter" key to exit , could suggest what can I do ? thx in advance.
peterchu
Super Advisor

Re: Telnet session

thx replies ,

the "read a" is work fine , it will exit after press enter , may I have more requirement , because the system will display the list of 70 users , but one screen can't display all users ( about only 23 users will be display on one screen ) , is it possible that it display first screen then wait the user press key to next screen ( another 23 users ) until all users listed , could suggest what can I do ? thx
Ahmed RAHAL
Advisor

Re: Telnet session

I would have just used the 'sleep xx' command so screen is seen for 'xx' seconds then automatically 'logout'. Some users don't comprehend that they are blocking others so you may hit your 75 max telnet sessions limit.

consider using 'who -q' to have a quick and short list of connected users.

else, 'who -u | more' may also give a page by page display, needing the user to hit a key to see all the pages. This may put the never-ending connections again.

HTH,
Ahmed Rahal
Ahmed RAHAL
Advisor

Re: Telnet session

btw,
you may skip session test if user is root (or any user below 100, usually, no real users):

---
if [ `id -u` -ge 100 ]; then
sessionCount=$(who|wc -l)
if [ $sessionCount -gt 70 ] ; then
who -q
echo "Unable to login (max session reached)"
sleep 30
logout
fi
fi
---
Fred Ruffet
Honored Contributor

Re: Telnet session

To have a page per page display, use this :
who -u | more
more wait for the user to press enter or space to scroll respectively one line or one page from input.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)