If you are planning to install Telnet functionality on your Linux system, you are likely aware of its significance in network management and debugging. To enable Telnet functionality on Linux using YUM, simply run the command sudo yum install -y telnet
to install the Telnet client. If you’re trying to run the telnet command in Linux and it returns a “command not found” error, this guide is for you. In this blog, we’ll walk you through the easiest way to install and enable Telnet on Linux using YUM, troubleshoot common issues, and even explore modern alternatives.
Relevance of Telnet
Although Telnet ( teletype network) lacks encryption, it remains an effective and straightforward way to test network connectivity, inspect port statuses, and troubleshoot network issues using simple Linux command-line tools. Its widespread use as a network debugging tool and remote login protocol proves its ongoing relevance.
While more secure options like SSH are favored for remote access, Telnet still serves specific purposes. For example, it is ideal for verifying open ports, troubleshooting SMTP on the Telnet server, or diagnosing network device connectivity through Telnet port testing. The simplicity of the `telnet` command makes it an indispensable tool for system administrators and network engineers.
What Is Telnet?
Telnet is a network protocol used for bidirectional interactive text-based communication between a client and a server. It controls a computer or network device via a command-line interface. It operates on port 23 and follows a client-server model. System administrators use it to test services like HTTP, SMTP, or FTP. Telnet transmits data in plain text, including passwords, which makes it vulnerable to eavesdropping and man-in-the-middle attacks. For this reason, Telnet is not recommended for use in production environments. However, in trusted local networks or for quick testing purposes, Telnet can still serve as a convenient tool.
Understanding YUM and Its Advantages
What is YUM?
YUM, which stands for Yellowdog Updater Modified, is a free and open-source command-line package management utility designed for Linux operating systems that use the RPM (Red Hat Package Manager) package format. Developed by Seth Vidal, YUM was first released in June 2002 and has since become an essential tool for managing software packages on Red Hat-based distributions, including Red Hat Enterprise Linux, Fedora, and CentOS.
YUM acts as a front-end to the RPM package manager, providing enhanced capabilities such as automatic dependency resolution, which simplifies the process of installing, updating, and removing software packages. Unlike RPM, which requires explicit specification of package sources, YUM can fetch packages from repositories without needing to manually point to the package sources.
Benefits of Using YUM
One of the primary advantages of using YUM is its ability to automatically resolve dependencies. When you install, update, or remove a package, YUM detects and manages all the necessary dependent packages, saving you the hassle of manually tracking and installing them. This feature makes package management significantly more efficient and user-friendly.
YUM also offers robust repository management. You can easily add or remove software repositories, allowing you to manage multiple sources of packages. This flexibility is particularly useful for maintaining a consistent and up-to-date set of software packages across your system.
In addition to its core functions, YUM can be configured through simple text files, enabling customization to suit specific user needs. This includes setting up automatic updates using the `yum-cron` service, which can be configured to check for updates at regular intervals, such as every hour or every day.
YUM’s command-line interface is intuitive and powerful, with a range of commands that allow you to perform various operations. For example, you can use yum install package_name
to install a package, yum remove package_name
to remove one, and yum update
to update all installed packages to the latest versions. These Linux commands for telnet make it easy to manage your software packages effectively.
Prerequisites Before Installing TELNET
Before utilizing Telnet on Linux, set up two machines: designate one as the Telnet client and the other as the target system. Additionally, ensure you have terminal software ready on the client machine to execute Telnet commands. You can opt for Linux’s built-in terminal or third-party applications such as PuTTY.
To ensure a smooth installation process, update your system’s package lists. This step guarantees that you have access to the latest package versions available in the repositories. Ensure you have administrative privileges (sudo access). CentOS 7/8, RHEL 7/8, or Fedora will be the compatible OS.
Open your terminal and run the following command to update your package lists:
sudo yum update
Step by Step Guide to Install Telnet in Linux Using YUM
Follow these steps to install Telnet on CentOS/RHEL-based systems.
Step 1: Update Your System
Ensure your system is up-to-date before installing new packages:
sudo yum update -y
Step 2: Install Telnet Client
To install the Telnet client (for connecting to remote servers):
sudo yum install telnet -y
This allows you to test connections to other services, such as checking if a web server is reachable:
telnet example.com 80
Step 3: Install Telnet Server
If you need to host a Telnet service (not recommended for production):
sudo yum install telnet-server xinetd -y
Xinetd package is a super-server that manages connections to various network services, including Telnet. It is often required to manage and control the Telnet service.
The -y flag automatically answers “yes” to any prompts that may appear during the installation, allowing the process to proceed without manual intervention.
Step 4: Configure Telnet Server on Linux
After installation, configure the Telnet service to start and enable it.
4.1. Enable the Telnet Service in Xinetd
Open the Telnet service file:
sudo vi /etc/xinetd.d/telnet
Set disable = no to enable the service:
Save and exit the file.
4.2: Restart Xinetd and Enable at Boot
sudo systemctl restart xinetd
sudo systemctl enable xinetd
This ensures the Telnet service starts automatically on boot.
Step 5: Open Firewall Ports for Telnet
By default, firewalls may block Telnet’s port (23). Add it to the firewall rules:
For Firewalld (CentOS/RHEL 7+):
sudo firewall-cmd --permanent --add-port=23/tcp
sudo firewall-cmd --reload
For iptables (Legacy Systems):
sudo iptables -A INPUT -p tcp --dport 23 -j ACCEPT
sudo service iptables save
Step 6: Test Your Telnet Setup
Use the Telnet client to verify connectivity:
- From a remote machine:
telnet <your-server-ip> 23
- If the connection is successful, you will see a login prompt.
Troubleshooting Common Issues
Issues may arise during installation or use due to missing or misconfigured YUM repositories
running a minimal or custom OS image and using a newer Linux distro where Telnet is deprecated.Here’s how to fix them:
“Command not found” Error
Reinstall the package:
sudo yum reinstall telnet
Connection Refused
Ensure the remote server runs Telnet and port 23 is open. Check with:
nmap <server-ip>
Whether the Telnet service is enabled in the /etc/xinetd.d/telnet
configuration file. Ensure the disable parameter is set to no.
Whether the firewall is blocking port 23. Confirm that port 23 is open in the firewall settings.
Whether the Telnet server is listening on the correct IP address and port, use the netstat -tuln
command to check if port 23 is in a listening state.
Server Not Accepting Connections
Verify the Telnet service is active:
sudo systemctl status telnet.socket
Confirm firewall settings allow port 23.
Fix “No Package Telnet Available” Error
If YUM can’t find Telnet, enable the EPEL repository:
sudo yum install -y epel-release
sudo yum clean all
sudo yum makecachetelnet
sudo yum install -y telnet
Resolve Firewall Conflicts
Allow Telnet through firewalld (port 23):
sudo firewall-cmd --permanent --add-port=23/tcp
sudo firewall-cmd --reload
Security Alerts from Antivirus Software:
Some antivirus software may flag Telnet connections as potential security risks. If you receive such alerts, review your antivirus settings to allow Telnet connections temporarily. However, for long-term use, it is still recommended to switch to more secure protocols like SSH.
Using Telnet Securely

Implement strict access controls and firewall rules to restrict access to Telnet services. Ensure that only necessary ports are open, and access is limited to trusted IP addresses. This can help reduce the attack surface and minimize the risk of unauthorized access. To set up DNS records, refer to the DNS documentation.
Regularly monitor your network traffic and system logs for any suspicious activity. Tools like tcpdump and system auditing tools can help detect and respond to potential security breaches promptly.
1. Limit Connections: To enhance security, you can limit the number of Telnet connections. Edit the /etc/xinetd.conf
file and adjust the instances and per_source parameters. For example:
instances = 10
per_source = 5
This limits the total number of simultaneous connections to 10 and restricts each source IP to a maximum of 5 connections. After making changes, restart the xinetd service.
2. Firewall Settings: Ensure the firewall allows traffic on Telnet’s default port 23. If using Firewalld, execute:
firewall-cmd --permanent --add-port=23/tcp
firewall-cmd --reload
If using UFW, run:
ufw allow 23/tcp
ufw reload
Alternative of telnet in linux
Tool | Command | Use Case |
SSH | ssh user@example.com | Encrypted remote access |
Netcat | nc -zv hostname 80 | Port Testing |
OpenSSL | openssl s_client -connect example.com:443 | SSL/TLS checks |
nmap | nmap -p 23 hostname | scanning and port testing |
Rlogin | rlogin hostname -l username | Remote login with flexibility |
Rsh | rsh hostname command | Remote command execution |
Explore our guides on SSH configuration or installing Netcat.
Applications of Telnet
Here are some of the applications:
1. Test Web Server Connectivity
Use Telnet to check if a web server (port 80) is reachable:
telnet www.example.com 80
If the connection is successful, you’ll see a blank screen. Then, type an HTTP request:
GET / HTTP/1.1
Host: www.example.com
Press Enter twice. The server will respond with HTTP headers and content.
2. Verify SMTP Server Availability
Test if an email server (port 25) is accepting connections:
telnet mail.example.com 25
You will receive a response like 220 mail.example.com ESMTP
.
3. Check Database Port Accessibility
Verify if a MySQL server (port 3306) is accessible:
telnet db.example.com 3306
A successful connection will show MySQL’s handshake packet.
4. Diagnose DNS Server Issues
Test if a DNS server (port 53) is responding:
telnet ns1.example.com 53
Note: This works only for DNS servers configured to accept TCP connections. Most DNS uses UDP.
5. Debug FTP Server Configuration
Check if an FTP server (port 21) is reachable:
telnet ftp.example.com 21
You’ll receive a 220 response. Type USER anonymous and PASS to test login functionality.
Conclusion
Telnet is no longer the go-to tool for secure communications, it remains useful for testing and working with legacy systems. With YUM, enabling Telnet functionality on Linux is straightforward, and troubleshooting errors is manageable with the tips provided. Consider using SSH or Netcat as safer alternatives. Still, knowing how to install and use Telnet in Linux remains a valuable skill in your sysadmin toolbox.
FAQ
1. How to uninstall Telnet?
To install Telnet use the following command: sudo yum remove -y telnet
2. Can I use DNF to install Telnet ?
Yes, on CentOS 8, use dnf install telnet. YUM works as an alias.
3. How do I install Telnet in Linux without YUM?
Use dnf on newer distributions or compile from source. For example:
sudo dnf install telnet
4. Can I use Telnet for web testing?
Yes, but it’s limited. For HTTP testing, tools like curl or wget are better suited.
5. Is Telnet supported on all Linux distributions?
Telnet is supported on most Linux distributions, but its installation method may vary. For Debian-based distributions like Ubuntu, use APT for installation; for Red Hat-based distributions like CentOS and RHEL, use YUM or DNF.
6. Can I use Telnet for HTTPS?
No, HTTPS uses SSL/TLS encryption. Use openssl s_client
instead.