Operating System - Linux
1829102 Members
2482 Online
109986 Solutions
New Discussion

Re: Control the telnet sessions

 
SOLVED
Go to solution
peterchu
Super Advisor

Control the telnet sessions

We have a RH Linux , and the users use telnet to access the system , how to control the no. of telnet to the system ? thx.
7 REPLIES 7
Alexander Chuzhoy
Honored Contributor
Solution

Re: Control the telnet sessions

add a line
instance = 3
to a file /etc/xinetd.d/telnet to limit the telnet to allow 3 simultanious connections.
service xinetd restart mut be executed after changes in /etc/xinetd.d/telnet file
Stuart Browne
Honored Contributor

Re: Control the telnet sessions

That will control the total number of telnet instances, not per user.

On a per-user basis, you'd best either use one of the funky scripts provided in various other threads on the same subject, or use pam to do the limiting in '/etc/pam.d/login':

session required /lib/security/pam_limits.so

And in '/etc/security/limits.conf' have an entry similar to:

* - maxlogins 3

To limit all users (except 'root' (or other UID 0 users)) to 3 simultaneous logins per user.
One long-haired git at your service...
Steven E. Protter
Exalted Contributor

Re: Control the telnet sessions

Excellent solutions Stuart.

I would add the following advice:

Drop telnet.

User authentication is happening in clear text. Even the root users password is easily sniffed by ethereal or a program that a user can bring in on a diskette or keychain drive.

Linux ships with openssh which includes ssh a telnet replacement with secure authentication.

A free windows version is at http://www.networksimplcity.com

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
Stuart Browne
Honored Contributor

Re: Control the telnet sessions

And the pam solution is portable to SSH too ;P Just use '/etc/pam.d/sshd' :)
One long-haired git at your service...
peterchu
Super Advisor

Re: Control the telnet sessions

thx replied , I treid to modify the file "/etc/xinetd.d/telnet"

the file as below now :
# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
instances = 200
}

but the user telnet still can over 200 , could suggest what is wrong ?
Stuart Browne
Honored Contributor

Re: Control the telnet sessions

Did you re-start (or re-load) 'xinetd' after modifying '/etc/xinetd.d/telnet' ?

The command 'service xinetd reload' should be sufficient.

Setting it to 200 should mean that you can have 200 actively-used telnet sessions at any given moment.

My small-scale test (instances = 5) works, forcibly dropping any excess session attempts.
One long-haired git at your service...
peterchu
Super Advisor

Re: Control the telnet sessions

very thanks, it is OK after restart the service , I missed the previous message from Alex .