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 36 Linux server or desktop workstation, along with some basic commands on connecting to a remote server using the command line terminal.
Table of Contents
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).
First, update your system to ensure all existing packages are up to date. This will ensure no conflicts arise as best as possible during the installation.
sudo dnf upgrade --refresh -y
Install Telnet Server
Fedora 36 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 -y
Next, enable the Telnet socket; the following command will activate it immediately.
sudo systemctl start telnet.socket
Do not enable Telnet on system boot, and this should only be used manually; when finished, disable it with the following command.
sudo systemctl disable telnet.socket
Once installed, check to ensure Telnet status is ok with the following command.
systemctl status telnet.socket
Connect Telnet Instance
Optional. Set Firewalld Rule
Firstly, if you have FirewallD 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, which 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 permitted to access the Telnet server.
sudo firewall-cmd --permanent --zone=telnet --add-source=22.214.171.124
Replace 126.96.36.199 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 to connect to your remote server using Telnet, use the following Telnet command and the IP address of the system you are connecting to, which also requires Telnet to be activated.
The tutorial Fedora 36 machine is connected to a remote Ubuntu 22.04 LTS system. Note, you will need the login information handy depending on the setup.
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 -y
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 on your Fedora 36 system.
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.