The tutorial explains about how to install telnet server on CentOS 7 / RHEL 7 . We will also keep SELINUX on enforcing mode and use the firewalld rules.
Telnet is a network protocol used on the Internet or local area networks to provide a bidirectional interactive text-oriented communication facility using a virtual terminal connection .
Recommended: We always recommend to use SSH because it communicates in encrypted way. Whereas telnet do not communicates in encrypted way.
Telnet Port Number
By default telnet server listens on port number 23/tcp .
To know more about telnet, read this Wikipedia link.
By default root is not able to login via telnet. Hence, use other system user.
Description about our Lab :
Operating System : CentOS 7
IP Address : 192.168.56.101 (This is also telnet server ip address)
Arch : x86_64
Install Telnet Server
Installing telnet-server is quite easy, Simply run the below command on your system terminal.
yum install telnet-server
Start/Stop/Restart Telnet service
To start the telnet service on CentOS 7 / RHEL 7 use the command –
systemctl start telnet.socket
To stop the telnet service on CentOS 7 / RHEL 7 use the command –
systemctl stop telnet.socket
To restart the telnet service on CentOS 7 / RHEL 7 use the command –
systemctl restart telnet.socket
To get status of the telnet service on CentOS 7 / RHEL 7 use the command –
systemctl status telnet.socket
Check listening port by telnet
To check listening port 23 by telnet on system, use ss command –
ss -tnlp|grep 23
Below given is reference from our system.It shows the port number 23 is listening.
[[email protected] ~]# ss -tnlp|grep 23 LISTEN 0 128 :::23 :::* users:(("systemd",1,53)) [[email protected] ~]#
Allow telnet from firewalld
We strictly recommend to use the telnet-server inside LAN only. It should not be accessible from Public network.
In below section, we are allowing source subnet 192.168.56.0/24 to access the telnet service by using firewalld command.
(Replace the 192.168.56.0/24 with your LAN network subnet or client ip address)
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.56.0/24" service name="telnet" log prefix="telnet" level="info" limit value="1/m" accept'
To access telnet-server, use the following command syntax
Syntax: Replace telnet-server-ip-address with ip address of telnet server.
It will prompt for giving username and password. Use system username other than root.
[email protected]:~/Desktop$ telnet 192.168.56.101 Trying 192.168.56.101... telnet: Unable to connect to remote host: No route to host [email protected]:~/Desktop$ telnet 192.168.56.101 Trying 192.168.56.101... Connected to 192.168.56.101. Escape character is '^]'. Kernel 3.10.0-123.el7.x86_64 on an x86_64 localhost login: test Password: Last login: Sat Dec 6 08:01:10 from ::ffff:192.168.56.1 [[email protected] ~]$