Updated: 30 September 2026 · Applies to: telnet 0.17 on AlmaLinux and Rocky Linux 9, inetutils-telnet 2.5 on Ubuntu 24.04 and 2.6 on Debian 13
Today the telnet command is mainly used as a quick tool to check whether a port on another server answers, for example a mail server on port 25. The telnet server, which gives remote logins, sends everything including passwords unencrypted; use SSH for logins instead. This guide replaces the older CentOS/RHEL 7 version (CentOS 7 reached end of life in June 2024).
Install the telnet client
sudo apt install telnet # Ubuntu, Debian (installs inetutils-telnet) sudo dnf install telnet # AlmaLinux, Rocky Linux, RHEL
Test a port
telnet mail.example.com 25
Connected to mail.example.com means the port is open; a mail server also greets you with a line starting 220. To leave, type quit, or press Ctrl+] and then type quit. Connection refused means nothing listens there, and a long wait ending in a time-out usually means a firewall blocks the port.
Modern alternatives
nc -zv mail.example.com 25 # netcat: open or not openssl s_client -connect mail.example.com:465 -brief # ports that use TLS curl -v telnet://mail.example.com:25 # not available with curl-minimal on RHEL 9
nc is in the netcat-openbsd package on Ubuntu and Debian and nmap-ncat on AlmaLinux and Rocky Linux.
The telnet server (not recommended)
If an old device or program really needs it, install it only on a private network and never expose port 23 to the internet:
sudo dnf install telnet-server && sudo systemctl enable --now telnet.socket # AlmaLinux, Rocky Linux sudo apt install inetutils-telnetd # Ubuntu, Debian
Remove it again when you no longer need it. For port numbers used by mail, see SMTP port numbers.
Ucartz services for this topic
- KVM VPS hosting: NVMe SSD and full root access, with Free Basic Managed Support.
- Unmanaged dedicated servers: full root access and free IPMI KVM, with Free Basic Managed Support.
- Linux server management: hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.
