Limit the number of Telnet sessions coming from the same remote system

last updated in Categories , , ,

Q. How do I configure telnet server so that I can limit the number of Telnet sessions coming from the same remote system under Cent OS Linux?

A. You can use iptables to limit the number of Telnet sessions coming from the same remote system. However iptables may take some time. CentOS (and Redhat Linux, Fedora Core) use xinetd to manage telnet server. You need to set per_source variable.

The per_source config directive can define the limit for Telnet sessions coming from the same remote system.

Open /etc/xinetd.d/telnet file
# vi /etc/xinetd.d/telnet
Append/modify per_source as follows:
per_source = 2

Save and close the file. At the end your file should read as follows:
service telnet

{
        disable = no
        flags           = REUSE
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/sbin/in.telnetd
        log_on_failure  += USERID
        per_source      = 2
}

Restart xinetd service:
# /etc/init.d/xinetd restart

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.