- CentOS / RHEL 7 : How to install and configure telnet
- Installing telnet packages
- Configuring/enabling telnet
- 1. Add the service to firewalld.
- 2. Add the service to selinux.
- 3. Enable and start the telnet service.
- 4. Verify
- How to install and use telnet command in Linux(RedHat/CentOS 7/8) Using 5 Easy Steps
- Install and Use Telnet Command in Linux
- Step 1: Prerequisites
- Step 2: Update Your System
- Step 3: Install Telnet Command
- Step 4: Verify Package Installation
- Step 5: Test Telnet Command
CentOS / RHEL 7 : How to install and configure telnet
It’s not recommended to use telnet as it is not secure. The passwords are transferred using a plain text and any packet sniffer can easily track you. Nevertheless, it’s sometimes required to install telnet anyways. To check if you have telnet package already installed on your system, use :
# rpm -qa | grep telnet telnet-server-0.17-59.el7.x86_64 telnet-0.17-59.el7.x86_64
In order to turn Telnet on make sure that you have the packages telnet-server and telnet installed:
Installing telnet packages
If the 2 required packages are not installed, install it using yum.
# yum install telnet-server telnet
Configuring/enabling telnet
1. Add the service to firewalld.
The built in firewalld blocks Telnet port 23 by default because the protocol is not considered secure. Please make sure that the port is open or if a non-default port is being used, that the port associated with Telnet is open for telnet traffic to pass through.
# firewall-cmd --add-service=telnet --zone=public
Run the rule again with the “–permanent” flag for it to persist across firewalld restarts.
# firewall-cmd --add-service=telnet --zone=public --permanent
2. Add the service to selinux.
You will have to also add the service to SELinux. This is required only in the case where SELinux is enabled on the system.
# semanage port -a -t telnetd_port_t -p tcp
3. Enable and start the telnet service.
Start the service using the systemctl command.
# systemctl start telnet.socket
Enable the telnet service to start at boot.
# systemctl enable telnet.socket
4. Verify
Once you are done with the configuration, verify if the telnet to a server works.
# telnet geeklab02 Trying 10.10.10.10. Connected to 10.10.10.10. Escape character is '^]'. Kernel 3.10.0-327.el7.x86_64 on an x86_64 geeklab02 login: testuser Password: Last login: Sat Jan 23 18:19:43 from geeklab [testuser@geeklab02 ~]$ hostname geeklab02
How to install and use telnet command in Linux(RedHat/CentOS 7/8) Using 5 Easy Steps
In this tutorial, I will take you through the steps to install and use telnet command in Linux. telnet command is used in Linux based system to check the remote server port connectivity from client system. Here when we say telnet command then we are referring to client package and not the telnet server package. By default telnet won’t be installed in your System. Hence before using telnet command in Linux you need to know the steps to install this command.
Install and Use Telnet Command in Linux
Step 1: Prerequisites
a)You need to have a Running RedHat/CentOS 7/8 System.
b)You should have yum installed in your System.
c)You should have sudo access to run privileged commands in your system.
Please note that here I am using root user to run all the below commands.You can use any user with sudo access to run all these commands.For more information Please check Step by Step: How to Add User to Sudoers to provide sudo access to the User.
Step 2: Update Your System
First you need to update all your packages with the latest available updates using yum update -y command as shown below.
[root@localhost ~]# yum update -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.piconets.webwerks.in * epel: mirrors.piconets.webwerks.in * extras: mirrors.piconets.webwerks.in * updates: mirrors.piconets.webwerks.in Resolving Dependencies --> Running transaction check ---> Package NetworkManager.x86_64 1:1.18.0-5.el7_7.2 will be updated ---> Package NetworkManager.x86_64 1:1.18.4-3.el7 will be an update ---> Package NetworkManager-libnm.x86_64 1:1.18.0-5.el7_7.2 will be updated ---> Package NetworkManager-libnm.x86_64 1:1.18.4-3.el7 will be an update ---> Package NetworkManager-team.x86_64 1:1.18.0-5.el7_7.2 will be updated ---> Package NetworkManager-team.x86_64 1:1.18.4-3.el7 will be an update ---> Package NetworkManager-tui.x86_64 1:1.18.0-5.el7_7.2 will be updated ---> Package NetworkManager-tui.x86_64 1:1.18.4-3.el7 will be an update ---> Package acl.x86_64 0:2.2.51-14.el7 will be updated ---> Package acl.x86_64 0:2.2.51-15.el7 will be an update ---> Package bash.x86_64 0:4.2.46-33.el7 will be updated ---> Package bash.x86_64 0:4.2.46-34.el7 will be an update ---> Package bind-export-libs.x86_64 32:9.11.4-9.P2.el7 will be updated ---> Package bind-export-libs.x86_64 32:9.11.4-16.P2.el7_8.2 will be an update ---> Package bind-libs-lite.x86_64 32:9.11.4-9.P2.el7 will be updated ---> Package bind-libs-lite.x86_64 32:9.11.4-16.P2.el7_8.2 will be an update ---> Package bind-license.noarch 32:9.11.4-9.P2.el7 use telnet command ---> Package bind-license.noarch 32:9.11.4-16.P2.el7_8.2 will be an update ---> Package binutils.x86_64 0:2.27-41.base.el7_7.3 will be updated ---> Package binutils.x86_64 0:2.27-43.base.el7 will be an update ---> Package centos-release.x86_64 0:7-7.1908.0.el7.centos will be updated ---> Package centos-release.x86_64 0:7-8.2003.0.el7.centos will be an update ---> Package cryptsetup-libs.x86_64 0:2.0.3-5.el7 will be updated ---> Package cryptsetup-libs.x86_64 0:2.0.3-6.el7 will be an update ---> Package curl.x86_64 0:7.29.0-54.el7_7.2 will be updated ---> Package curl.x86_64 0:7.29.0-57.el7 will be an update ---> Package device-mapper.x86_64 7:1.02.158-2.el7_7.2 will be updated ---> Package device-mapper.x86_64 7:1.02.164-7.el7_8.1 will be an update ---> Package device-mapper-event.x86_64 7:1.02.158-2.el7_7.2 will be updated ---> Package device-mapper-event.x86_64 7:1.02.164-7.el7_8.1 will be an update ---> Package device-mapper-event-libs.x86_64 7:1.02.158-2.el7_7.2 will be updated ---> Package device-mapper-event-libs.x86_64 7:1.02.164-7.el7_8.1 will be an update ---> Package device-mapper-libs.x86_64 7:1.02.158-2.el7_7.2 will be updated ---> Package device-mapper-libs.x86_64 7:1.02.164-7.el7_8.1 will be an update ---> Package device-mapper-persistent-data.x86_64 0:0.8.5-1.el7 will be updated ---> Package device-mapper-persistent-data.x86_64 0:0.8.5-2.el7 will be an update ---> Package dhclient.x86_64 12:4.2.5-77.el7.centos will be updated ---> Package dhclient.x86_64 12:4.2.5-79.el7.centos will be an update ---> Package dhcp-common.x86_64 12:4.2.5-77.el7.centos will be updated ---> Package dhcp-common.x86_64 12:4.2.5-79.el7.centos will be an update ---> Package dhcp-libs.x86_64 12:4.2.5-77.el7.centos will be updated ---> Package dhcp-libs.x86_64 12:4.2.5-79.el7.centos will be an update ---> Package dracut.x86_64 0:033-564.el7 will be updated ---> Package dracut.x86_64 0:033-568.el7 will be an update ---> Package dracut-config-rescue.x86_64 0:033-564.el7 will be updated ---> Package dracut-config-rescue.x86_64 0:033-568.el7 will be an update ---> Package dracut-network.x86_64 0:033-564.el7 will be updated ---> Package dracut-network.x86_64 0:033-568.el7 will be an update ---> Package e2fsprogs.x86_64 0:1.42.9-16.el7 will be updated ---> Package e2fsprogs.x86_64 0:1.42.9-17.el7 use telnet command ---> Package e2fsprogs-libs.x86_64 0:1.42.9-16.el7 will be updated ---> Package e2fsprogs-libs.x86_64 0:1.42.9-17.el7 will be an update ---> Package elfutils-default-yama-scope.noarch 0:0.176-2.el7 will be updated ---> Package elfutils-default-yama-scope.noarch 0:0.176-4.el7 will be an update ---> Package elfutils-libelf.x86_64 0:0.176-2.el7 will be updated ---> Package elfutils-libelf.x86_64 0:0.176-4.el7 will be an update ---> Package elfutils-libs.x86_64 0:0.176-2.el7 will be updated ---> Package elfutils-libs.x86_64 0:0.176-4.el7 will be an update ---> Package epel-release.noarch 0:7-11 will be updated ---> Package epel-release.noarch 0:7-12 will be an update ---> Package expat.x86_64 0:2.1.0-10.el7_3 use telnet command ---> Package expat.x86_64 0:2.1.0-11.el7 will be an update ---> Package file.x86_64 0:5.11-35.el7 will be updated ---> Package file.x86_64 0:5.11-36.el7 will be an update ---> Package file-libs.x86_64 0:5.11-35.el7 will be updated ---> Package file-libs.x86_64 0:5.11-36.el7 use telnet command ---> Package firewalld.noarch 0:0.6.3-2.el7_7.4 will be updated ---> Package firewalld.noarch 0:0.6.3-8.el7_8.1 will be an update ---> Package firewalld-filesystem.noarch 0:0.6.3-2.el7_7.4 will be updated ---> Package firewalld-filesystem.noarch 0:0.6.3-8.el7_8.1 will be an update ---> Package gettext.x86_64 0:0.19.8.1-2.el7 will be updated ---> Package gettext.x86_64 0:0.19.8.1-3.el7 will be an update ---> Package gettext-libs.x86_64 0:0.19.8.1-2.el7 will be updated ---> Package gettext-libs.x86_64 0:0.19.8.1-3.el7 use telnet command ---> Package glibc.x86_64 0:2.17-292.el7 will be updated ---> Package glibc.x86_64 0:2.17-307.el7.1 will be an update ---> Package glibc-common.x86_64 0:2.17-292.el7 use telnet command ---> Package glibc-common.x86_64 0:2.17-307.el7.1 will be an update ---> Package grub2.x86_64 1:2.02-0.80.el7.centos will be updated ---> Package grub2.x86_64 1:2.02-0.81.el7.centos use telnet command ---> Package grub2-common.noarch 1:2.02-0.80.el7.centos will be updated ---> Package grub2-common.noarch 1:2.02-0.81.el7.centos will be an update ---> Package grub2-pc.x86_64 1:2.02-0.80.el7.centos will be updated ---> Package grub2-pc.x86_64 1:2.02-0.81.el7.use telnet command ---> Package grub2-pc-modules.noarch 1:2.02-0.80.el7.centos will be updated ---> Package grub2-pc-modules.noarch 1:2.02-0.81.el7.centos will be an update ---> Package grub2-tools.x86_64 1:2.02-0.80.el7.centos will be updated ---> Package grub2-tools.x86_64 1:2.02-0.81.el7.centos will be an update ---> Package grub2-tools-extra.x86_64 1:2.02-0.80.el7.centos use telnet command ---> Package grub2-tools-extra.x86_64 1:2.02-0.81.el7.centos will be an update ---> Package grub2-tools-minimal.x86_64 1:2.02-0.80.el7.centos will be updated ---> Package grub2-tools-minimal.x86_64 1:2.02-0.81.el7.centos will be an update ---> Package hwdata.x86_64 0:0.252-9.3.el7 will be updated ---> Package hwdata.x86_64 0:0.252-9.5.el7 will be an update ---> Package initscripts.x86_64 0:9.49.47-1.el7 will be updated ---> Package initscripts.x86_64 0:9.49.49-1.el7 use telnet command ---> Package iptables.x86_64 0:1.4.21-33.el7 will be updated ---> Package iptables.x86_64 0:1.4.21-34.el7 will be an update ---> Package iwl100-firmware.noarch 0:39.31.5.1-72.el7 will be updated
Step 3: Install Telnet Command
Once system packages are updated with the latest version, you can now install telnet client package using yum install telnet -y command as shown below.
[root@localhost ~]# yum install telnet -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.piconets.webwerks.in * epel: mirrors.piconets.webwerks.in * extras: mirrors.piconets.webwerks.in * updates: mirrors.piconets.webwerks.in Resolving Dependencies --> Running transaction check ---> Package telnet.x86_64 1:0.17-65.el7_8 will be installed --> Finished Dependency Resolution Dependencies Resolved ======================================================================================================================================================================== Package Arch Version Repository Size ======================================================================================================================================================================== Installing: telnet x86_64 1:0.17-65.el7_8 updates 64 k Transaction Summary ======================================================================================================================================================================== Install 1 Package Total download size: 64 k Installed size: 113 k Is this ok [y/d/N]: y Downloading packages: telnet-0.17-65.el7_8.x86_64.rpm | 64 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:telnet-0.17-65.el7_8.x86_64 1/1 Verifying : 1:telnet-0.17-65.el7_8.x86_64 1/1 Installed: telnet.x86_64 1:0.17-65.el7_8 Complete!
Step 4: Verify Package Installation
After successful Installation of telnet client package, you can check and verify the installation by querying the rpmdb using rpm command as shown below.
[root@localhost ~]# rpm -qa | grep -i telnet telnet-0.17-65.el7_8.x86_64
Step 5: Test Telnet Command
Now you can use telnet command to test the port connectivity with the remote server. In below example we are using telnet command to check the google.com Port 443 connectivity by running telnet google.com 443 command. As you can see the status is showing connected it means local client is able to reach to remote google.com server on Port 443 .
[root@localhost ~]# telnet google.com 443 Trying 216.58.196.174. Connected to google.com. Escape character is '^]'.
Popular Recommendations:-