Enabling telnet on Linux requires installing the telnet client and, if needed, the telnet server package for remote access. This guide walks you through how to install telnet in linux step by step, covering both client and server setups across major distributions. Telnet remains useful for testing network services and troubleshooting legacy systems, even though SSH is more secure for daily use.
Telnet sends data in plain text, so it’s not recommended for sensitive environments. However, for internal labs or quick connectivity checks, it’s still a handy tool. You’ll learn to install it on Ubuntu, Debian, CentOS, RHEL, Fedora, and Arch Linux.
Prerequisites For Installing Telnet
Before you start, ensure you have sudo or root access on your Linux system. You’ll also need an active internet connection to download packages from your distribution’s repository.
- A Linux machine (physical or virtual)
- Terminal access with sudo privileges
- Basic familiarity with command-line operations
- Firewall rules configured if enabling the telnet server
How To Install Telnet In Linux
This section covers the exact commands for installing the telnet client on various Linux distributions. The process is straightforward and takes only a few minutes.
Installing Telnet On Ubuntu And Debian
Ubuntu and Debian use the apt package manager. Open your terminal and run these commands.
- Update your package list:
sudo apt update - Install the telnet client:
sudo apt install telnet -y - Verify installation:
telnet --version
If you need the telnet server for incoming connections, install xinetd and telnetd:
sudo apt install xinetd telnetd -y
Then enable and start the service:
sudo systemctl enable xinetd
sudo systemctl start xinetd
Installing Telnet On CentOS, RHEL, And Fedora
For Red Hat-based systems, use the yum or dnf package manager. CentOS 7 and RHEL 7 use yum, while CentOS 8 and Fedora use dnf.
For CentOS 7 / RHEL 7:
- Install telnet client:
sudo yum install telnet -y - For server:
sudo yum install telnet-server xinetd -y - Start services:
sudo systemctl start telnet.socket - Enable on boot:
sudo systemctl enable telnet.socket
For CentOS 8 / Fedora:
- Install telnet client:
sudo dnf install telnet -y - For server:
sudo dnf install telnet-server -y - Enable socket:
sudo systemctl enable --now telnet.socket
Note that telnet-server may not be available in default repos on newer Fedora versions. You might need to enable EPEL or use alternative methods.
Installing Telnet On Arch Linux
Arch Linux uses pacman. Install the inetutils package which includes telnet.
- Update system:
sudo pacman -Syu - Install inetutils:
sudo pacman -S inetutils - Verify:
telnet localhost
For the telnet server, install xinetd and telnetd from AUR or compile manually. Most Arch users skip the server component due to security concerns.
Configuring The Telnet Server
After installing the server package, you need to configure it properly. This ensures remote clients can connect securely within your network.
Editing The Xinetd Configuration
On systems using xinetd, edit the telnet configuration file:
sudo nano /etc/xinetd.d/telnet
Ensure the file contains these lines:
service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
Save the file and restart xinetd:
sudo systemctl restart xinetd
Configuring Firewall Rules
Telnet uses port 23 by default. You must allow traffic through your firewall.
For firewalld (CentOS/RHEL/Fedora):
sudo firewall-cmd --permanent --add-port=23/tcp
sudo firewall-cmd --reload
For UFW (Ubuntu/Debian):
sudo ufw allow 23/tcp
Always restrict access to trusted IP addresses if possible. Use sudo ufw allow from 192.168.1.0/24 to any port 23 for subnet restrictions.
Testing Telnet Connectivity
Once installed and configured, test the connection from a client machine.
- Open terminal on the client
- Run:
telnet [server-ip] 23 - Enter your username and password when prompted
If you see a login prompt, the setup works. Common issues include firewall blocks or the telnet service not running. Check with sudo systemctl status xinetd or sudo systemctl status telnet.socket.
For local testing, use telnet localhost on the server itself. This confirms the daemon is active.
Security Considerations
Telnet transmits data unencrypted, including passwords. This makes it vulnerable to packet sniffing. Use it only in isolated lab environments or for temporary diagnostics.
- Never expose telnet to the internet
- Use SSH instead for production systems
- Disable telnet after testing
- Monitor logs for unauthorized access
- Consider using stunnel to encrypt telnet traffic if absolutely necessary
If you must run telnet, implement IP whitelisting and strong passwords. Better yet, use SSH with key-based authentication for secure remote access.
Troubleshooting Common Issues
Even with correct installation, problems can arise. Here are frequent issues and solutions.
Telnet Command Not Found
If you see “command not found,” the client package isn’t installed. Double-check your package manager commands. On some minimal installations, telnet is omitted.
Reinstall using the steps above. On Ubuntu, ensure you ran sudo apt install telnet without typos.
Connection Refused
This usually means the telnet server isn’t running or the port is blocked. Verify the service status:
sudo systemctl status xinetd or sudo systemctl status telnet.socket
Check firewall rules with sudo iptables -L or sudo firewall-cmd --list-all. Ensure port 23 is open.
Login Issues After Connection
If you connect but can’t log in, check that the user account exists and has a password. Telnet uses system authentication. Also verify that the shell is set correctly in /etc/passwd.
Sometimes PAM modules block telnet. Check /etc/pam.d/remote or /etc/pam.d/login for restrictions.
Alternative To Telnet
For secure remote access, use SSH. It encrypts all traffic and is available by default on most Linux systems.
If you only need to test port connectivity, use nc (netcat) or nmap. These tools don’t require a full login session.
For legacy systems that only support telnet, consider upgrading to SSH-capable versions. Many older devices now have SSH alternatives.
Uninstalling Telnet
When you no longer need telnet, remove it to reduce attack surface.
Ubuntu/Debian:
sudo apt remove telnet telnetd xinetd --purge
CentOS/RHEL/Fedora:
sudo yum remove telnet telnet-server xinetd or sudo dnf remove telnet telnet-server
Arch Linux:
sudo pacman -R inetutils
Also remove firewall rules if you added them specifically for telnet.
Frequently Asked Questions
Is Telnet Safe To Use On Linux?
Telnet is not safe for production use because it sends data in plain text. Use it only in controlled lab environments or for temporary troubleshooting. Always prefer SSH for remote access.
How Do I Check If Telnet Is Installed On My System?
Run telnet --version in the terminal. If it returns version info, telnet is installed. Alternatively, use which telnet or dpkg -l | grep telnet on Debian-based systems.
Can I Install Telnet On Linux Without Internet?
Yes, if you have the package files locally. Download the .deb or .rpm packages on another machine and transfer them via USB. Then install using sudo dpkg -i package.deb or sudo rpm -ivh package.rpm.
What Port Does Telnet Use By Default?
Telnet uses TCP port 23. Ensure this port is open in your firewall for both client and server communication.
How To Enable Telnet On Linux For Remote Access?
Install the telnet-server package, configure xinetd or systemd socket, open port 23 in the firewall, and start the service. Then clients can connect using telnet server-ip.
Final Thoughts
Installing telnet on Linux is a simple process that varies slightly by distribution. Whether you need it for legacy system management or network diagnostics, the steps above cover all major platforms. Remember that security should be your top priority—limit telnet usage to trusted networks and disable it when not in use.
If you encounter any errors, double-check your package manager commands and firewall settings. The telnet client is lightweight and easy to remove once your task is complete. For modern remote administration, always choose SSH over telnet.
Now you have the knowledge to install, configure, and troubleshoot telnet on any Linux system. Use it wisely and keep your systems secure.