Telnet is a protocol that allows you to connect to remote computers (called hosts) over a TCP/IP network using a client-server protocol to establish a connection to Transmission Control Protocol port number 23
In the following tutorial, you will learn how to install Telnet on a Fedora 35 operating system.
- Recommended OS: Fedora Linux 35
- User account: A user account with sudo or root access.
Update Operating System
Update your Fedora operating system to make sure all existing packages are up to date:
sudo dnf upgrade --refresh -y
The tutorial will be using the sudo command and assuming you have sudo status.
To verify sudo status on your account:
Example output showing sudo status:
[joshua@fedora ~]$ sudo whoami root
To set up an existing or new sudo account, visit our tutorial on Adding a User to Sudoers on Fedora.
To use the root account, use the following command with the root password to log in.
Install Dependency Required
Before you proceed with the installation, run the following command to install or check that the package dnf-plugins-core is installed on your Fedora desktop.
sudo dnf install dnf-plugins-core -y
By default, this should be installed.
Warning About using Telnet
The tutorial will show you how to install Telnet for historical purposes and use in local environments, isolated networks. It is highly recommended not to use Telnet on an open network connection to the Internet because the data is sent over the connection, including sensitive information such as passwords and other confidential information that is not encrypted so the data can be easily intercepted by a hacker and misused. To safely connect to remote servers over public networks, you should always use SSH (Secure Shell).
Install Telnet Server
By default, Fedora 35 repositories come with the Telnet package available to install using the dnf package manager.
First, use the following command to install:
sudo dnf install telnet telnet-server
Type “Y,” then press the “ENTER KEY” to proceed with the installation.
Once installed, check to make sure Telnet status is operating ok with the following:
sudo systemctl status telnet
Connect to your Telnet
Optional. Set Firewalld Rule
Firstly, if you have UFW installed to connect to your remote running Telnet, you will need to set up an allow rule. By default, Telnet runs on port 23.
To set up an allow rule in FirewallD can be done in several ways. It is highly recommended to give the IP of the connecting server only if at significantly worse the subnet. Do not leave port 23 open to everything, and this will lead to brute force attempts.
First, add a new dedicated zone for Telnet firewalld policy:
sudo firewall-cmd --permanent --new-zone=telnet
Next, specify the allowed IP addresses that are permitted to access the Telnet server.
sudo firewall-cmd --permanent --zone=telnet --add-source=220.127.116.11
Replace 18.104.22.168 with the IP address that will be added to the allow list.
Once you have finished adding the IP addresses, open the port of the Telnet. By default, this is TCP port 23.
sudo firewall-cmd --permanent --zone=telnet --add-port=23/tcp
Note, you can change the default port in your configuration file if you change the firewall port open rule above to the new value.
After running those commands, reload the firewall to implement the new rules:
sudo firewall-cmd --reload
Example output if successful:
Now that you have set up a FirewallD rule so you can connect to your remote server using Telnet, use the following (Telnet) command:
How to Remove (Uninstall) Telnet
To remove Telnet from your operating system, all you need to do is use the following command:
sudo dnf autoremove telnet telnet-server
Type “Y,” then press the “ENTER KEY” to proceed with the uninstall.
Comments and Conclusion
In the tutorial, you have learned how to install, set up a firewall rule, and connect to a remote server using Telnet.
Overall, in today’s world, the most secure form of communication of this nature is to use SSH instead of Telnet. However, development environments that run on remote local networks Telnet can be more helpful. Still, you would never run Telnet in a public network these days, and it would open your server up to a very high risk in doing so.