How to enable telnet server on CentOS/RHEL?

I normally use telnet server as a backup login system for OpenSSH when I perform some system maintenance. By default, this service is not enable, we have to install and config it. How can we enable telnet login on RHEL or CentOS?

It’s kind of easy if you know the details. We have to install the server package since it’s installed by default, and updatexinetd settings to enable telnet service.

Install Telnet-server

$ sudo yum install -y telnet-server

We don’t need to install telnet client, as it’s by default installed on common linux distributions.

Update xinet.d settings to enable telnet
These two commands do the trick, and will also make telnet service start automatically on every reboot,

# chkconfig telnet on
# chkconfig xinetd on

The first command set disable in /etc/xinetd.d/telnet to no, and the second is to mark xinetd autostart on runlevel 345,

# cat /etc/xinetd.d/telnet
# 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
}
# chkconfig --list xinetd
xinetd         	0:off	1:off	2:off	3:on	4:on	5:on	6:off

Now we are all set. Time to start the service, and check running status,

# service xinetd restart
Stopping xinetd: [  OK  ]
Starting xinetd: [  OK  ]

# netstat -lnpt | grep :23
tcp        0      0 0.0.0.0:23                  0.0.0.0:*                   LISTEN      26605/xinetd
Share Button

Leave a comment

Your email address will not be published. Required fields are marked *