Support Online
Skip to main content

Linux Telnet Command Usage: Installation, Port Testing and Security

Telnet is one of the oldest tools used to test network connections in the Linux and Unix world.
In this guide, you will learn what Telnet does, how to set it up, and why it should be used with caution.

What Will You Learn in This Guide?

  • Basic working logic of Telnet command
  • Telnet installation steps in Linux
  • Perform open port tests via Telnet
  • Security risks of Telnet
  • SSH and other modern alternatives

Technical Summary

This guide covers the use of Telnet protocol and telnet command on Linux systems.
The main purpose is to test network connections and open ports.

Steps covered:

  • Telnet setup
  • Service and firewall settings
  • Port test and practical use
  • Redirection to safe alternatives

What is Telnet?

Telnet (Teletype Network) is an older protocol that establishes text-based connections to remote systems.
By default it uses TCP port 23.

Telnet traffic is not encrypted.
Therefore, nowadays it is recommended only for testing purposes.


⚠️ Security Warning

Telnet is not secure.
Usernames and passwords are transmitted in plaintext.

Always use SSH for administrative operations.


Telnet Setup in Linux

####RHEL/CentOS/Fedora

dnf install telnet telnet-server -y
  • This command installs Telnet client and server packages.


systemctl start telnet.socket
systemctl enable telnet.socket
  • This command starts the Telnet service.


firewall-cmd --permanent --add-port=23/tcp
firewall-cmd --reload
  • This command opens port 23 in the firewall.

Ubuntu/Debian


sudo apt install telnetd -y
  • This command installs the Telnet service.


sudo ufw allow 23/tcp
sudo ufw reload
  • This command allows Telnet traffic over UFW.

Telnet Usage and Practical Examples

Basic Syntax

telnet IP_ADRESI PORT
  • If no port is specified, 23 is used by default.

Connecting to Remote Server

telnet ornek.com
  • This command initiates a Telnet connection.

Open Port Test (Most Common Use)

telnet 192.168.1.50 22
  • This command tests whether the SSH port is open.

SMTP Server Test

telnet mail.ornek.com 25
  • This command checks whether the mail server is responding or not.

Common Mistakes and Their Meaning

  1. “Connection Refused” Error This error usually means:

Port 2 is closed

  1. The service is not working

  2. Firewall is blocking the connection

  3. Secure Alternatives to Use Instead of Telnet

  • SSH: Secure remote server management

Netcat (nc): Advanced port and network tests

cURL: HTTP/HTTPS and API tests

  • Telnet is only suitable for very limited scenarios.

Using Telnet in Windows
  • In Windows, the Telnet client is turned off by default. It can be activated in the following way:

Control Panel → Programs → Windows Features → Telnet Client


Frequently Asked Questions (FAQ)

1. Can my information be stolen via Telnet? Yes. Telnet traffic is not encrypted.

2. How to exit Telnet connection? Type Ctrl + ] followed by quit.

3. Why is Telnet still used? For port testing and simple network checks.

4. What should I use instead of Telnet? SSH should be preferred for remote access.


Result

Telnet can still be useful for diagnosing network problems. However, due to security risks, its use for administrative purposes is not recommended.

For modern and secure solutions, SSH, nc and cURL should be preferred.

You can safely use these tools on your Linux servers on GenixNode infrastructure 🚀