Install Telnet Server on CentOS 7 / RHEL 7

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.

About Telnet

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.

IMPORTANT NOTE:
By default root is not able to login via telnet. Hence, use other system user.

Diagram :

telnet server

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.

[root@localhost ~]# ss -tnlp|grep 23
LISTEN     0      128                      :::23                      :::*      users:(("systemd",1,53))
[root@localhost ~]# 

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'

Access telnet-server

To access telnet-server, use the following command syntax
Syntax: Replace telnet-server-ip-address with ip address of telnet server.

telnet telnet-server-ip-address

It will prompt for giving username and password. Use system username other than root.

sharad@linuxworld:~/Desktop$ telnet 192.168.56.101
Trying 192.168.56.101...
telnet: Unable to connect to remote host: No route to host
sharad@linuxworld:~/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
[test@localhost ~]$

Similar Posts

10 Comments

  1. Thank you for this info. I see that telnet socket becomes inactive very soon on my newly installed RHEL7.2 host . How do I change the setting?

    1. Thank you for sharing tip Chasil,

      I prefer to do not rename busybox, it helps for no conflict when we install actual telnet package or no confusion to other user.
      Overall the tip is nice. Keep sharing the good tips with Linux and Open Source World.

      Really appreciate.

      Best Regards
      Sharad

Comments are closed.