Dec 02, 2025
Ariffud M.
9min Read
Telnet (short for teletype network) is a command-line tool that facilitates remote communication and network testing. It was widely used for managing servers and devices, but its lack of encryption raised security concerns in modern environments, leading to its decline in favor of alternatives, like secure shell (SSH).
Nowadays, telnet remains a valuable utility for testing network services, debugging connectivity issues, analyzing server responses, and learning about network protocols.
In this article, we’ll cover everything you need to know about using telnet in Linux, including its installation, basic syntax and options, modern use cases, and important security considerations. By the end of this guide, you’ll be able to use this versatile networking tool in controlled environments.
Before using telnet in Linux, prepare two machines: one as the telnet client and the other as the target system.
You can use two Linux desktop computers, one desktop and one virtual private server (VPS), or, as in this tutorial, two VPS setups from Hostinger. If you choose the latter, select any plan that suits your needs. Since we’re only practicing telnet commands, the most basic plan, KVM 1, will suffice for both servers.
Next, make sure you have authorization for the target machine and know its IP address. If you’re a Hostinger VPS user, you can find your server’s IP in hPanel by going to VPS → Manage → Overview.

Warning! Accessing unauthorized systems is illegal and unethical. In our case, we can execute commands freely since we own both Linux machines.
Confirm that you have administrative or sudo privileges to install and configure telnet on the client and target system. For Hostinger VPS customers, we grant you full root access so you can modify your server as needed.
Furthermore, prepare terminal software to execute telnet commands on the client machine. You can use Linux’s built-in terminal or third-party software like PuTTY. Alternatively, Hostinger offers a Browser terminal that lets you run commands directly in your browser without installing other apps.
To use this feature, hit the corresponding button in the top-right corner of your VPS dashboard. This will open a new browser tab where you can start executing commands.


In this section, we’ll install telnet on the primary client machine and the target remote system. Follow the instructions carefully and make sure you run the commands on the correct machine.
Primary client machine
Here are the steps to install the telnet client on different Linux distributions:
sudo apt update && sudo apt upgrade
sudo dnf upgrade
sudo apt install telnet # Debian-based systems
sudo dnf install telnet # RHEL-based systems
telnet
The installation was successful if it displays the interactive telnet session like this:

Exit the session with:
quit
Target remote system
On the target system, you’ll need to install the telnet server, open its port in the firewall, and create a dedicated user, as telnet doesn’t allow root access by default for security reasons. Follow these steps:
sudo apt update && sudo apt upgrade # Debian-based systems
sudo dnf upgrade # RHEL-based systems
sudo apt install telnetd # Debian-based systems
sudo dnf install telnet-server # RHEL-based systems
sudo systemctl start telnet.socket sudo systemctl enable telnet.socket
systemctl status inetd # Debian-based systems
systemctl status telnet.socket # RHEL-based systems

sudo ufw allow 23/tcp sudo ufw reload
sudo firewall-cmd --permanent --add-port=23/tcp sudo firewall-cmd --reload
sudo useradd new_user
sudo passwd new_user
You’ll be prompted to enter and confirm the password.

If you no longer need telnet on your system, uninstall it with:
sudo apt remove telnet telnetd # Debian-based systems
sudo dnf remove telnet telnet-server # RHEL-based systems
The basic syntax of telnet is as follows:
telnet [options] [remote_server_ip] [port]
When executed, the command will establish a connection to the specified server. You’ll be prompted to enter the username and password you previously created for telnet:

Like many Linux commands such as ssh, scp, and ftp, you can append options to the telnet command to customize its behavior. Below are the most commonly used options and their purposes:
| Option | Purpose |
| -4 | Forces the use of IPv4. |
| -6 | Forces the use of IPv6. |
| -a | Attempts automatic authentication based on the local username. |
| -b | Specifies the local IP address to bind before making a connection. |
| -c | Disables reading of the user’s .telnetrc file. |
| -d | Enables debug mode to display detailed diagnostic information. |
| -e char | Sets the escape character for the telnet session. |
| -E | Disables the escape character, treating all input as literal. |
| -k | Sends the specified Kerberos principal during authentication. |
| -l user | Specifies the username for automatic login. |
| -n file | Logs the session into a specified file. |
| -x | Enables encryption for the session if supported. |
| -X | Disables the TELNET STARTTLS option. |
| -? | Displays the help menu for telnet. |
| -V | Displays the version of the telnet client. |
For instance, if you have multiple telnet users and want to specify one initially, you can run the command below. Replace user and remote_server_ip with your actual credentials:
telnet -l user remote_server_ip
After successfully logging into the remote machine, you can interact with its shell as if it were your primary server.
If you want to exit the session, simply type:
logout
You’ll be disconnected from the telnet session.

You can also enter the interactive session, as we did earlier to test if telnet was correctly installed, by typing telnet without any arguments:
telnet
Here are some safe examples of using telnet in modern environments, from examining mail servers to troubleshooting custom port issues.
Telnet can help diagnose Simple Mail Transfer Protocol (SMTP) server issues and verify configurations. The process typically involves testing whether the server accepts connections, processes commands correctly, and handles email transmissions.
To connect to an SMTP server using telnet, follow these steps:
telnet smtp.example.tld 25
If the connection is successful, you’ll see a welcome message from the mail server, similar to:

HELO domain.tld

MAIL FROM:<mail_sender@domain.tld>
RCPT TO:<mail_recipient@domain.tld>
DATA
Subject: Test Email This is a test email sent using telnet. .
The server should confirm the message has been queued.
QUIT

There are several SMTP ports you can use: 25, 465, 587, and 2525. Learn their differences and how to choose the right one for your needs.
Besides testing SMTP servers, telnet also proves handy for checking Post Office Protocol 3 (POP3) servers. Using this method, you can authenticate and interact with your inbox to troubleshoot email retrieval issues.
The guide to testing a POP3 server is as follows:
telnet pop.example.tld 110

USER address@domain.tld USER domain.tld
PASS your_password
If successful, you should see:

STAT
LIST

RETR id
QUIT
You can use telnet to debug HyperText Transfer Protocol (HTTP) servers by connecting to them on port 80, the default port for HTTP traffic. This approach lets you manually send requests and check if the server responds correctly.
If your remote machine has an HTTP server, here’s how to debug it:
telnet remote_server_ip 80
GET / HTTP/1.1 Host: domain.tld
Make sure to press Enter twice after entering the request.

As usual, type quit once you’re done debugging.
Instead of using telnet, you can check your Hostinger VPS availability and reachability by asking Kodee AI assistant. Simply ask, “Check if any of my VPS experiences downtime, issues, or disruptions.”
Using telnet to test a File Transfer Protocol (FTP) server is a quick way to verify if it’s operating correctly and if the default port 21 is not blocked. Please note that this is for testing purposes only. When transferring files, always use more secure protocols like FTPS or SFTP.
Here are the instructions to check your FTP server:
telnet remote_server_ip 21

SYST
FEAT

Internet Relay Chat (IRC) is a protocol for real-time text communication used for group chats and discussions. While modern messaging platforms have largely replaced it, you can still connect to an IRC server using telnet to test its availability and interact with it.
Keep in mind that IRC is a plain-text protocol, so avoid sharing sensitive information over it. Follow these steps to connect to an IRC server with telnet:
telnet irc.domain.tld 6667

NICK your_nickname
USER your_username 0 * :Your Full Name

JOIN #channel_name
If successful, you’ll receive messages from the channel, including a list of users currently in the chat:

PRIVMSG #channel_name :Your message here
QUIT :Goodbye message
Last but not least, telnet lets you test connectivity to any open port, making it especially useful if you have non-standard services running on custom ports or if you’ve changed a service’s default port to a custom one, such as switching SSH from port 22 to another.
Here’s how to do so:
telnet remote_server_ip port
You’ll receive a response if the port is open and the service is running. Otherwise, telnet will display an error message:

GET /custom_endpoint HTTP/1.1 Host: remote_server_ip
Depending on the application, the service will respond with data specific to the custom port, such as headers, messages, or even error codes.
Telnet was historically used for remote connections and network administration. However, all data, including sensitive information like usernames and passwords, is transmitted in plaintext. This makes it highly vulnerable to interception by attackers, especially on public or untrusted networks.
Due to these risks, you should only run telnet in controlled or local environments for basic debugging tasks, such as testing open ports or verifying SMTP communication.
For secure remote server communications, it’s better to use SSH, as this protocol encrypts all data in transit, protecting your information from potential eavesdropping.
If you need to test secure protocols or encrypted services, consider safer alternatives like openssl or Netcat (nc). These tools let you securely debug and test network connections, which are ideal for sensitive applications.
In this article, we’ve covered how to use the telnet command to test services like SMTP, POP3, HTTP servers, and specified ports. This shows how telnet remains useful for troubleshooting network issues in a controlled or local Linux environment.
However, due to its lack of encryption, you should use the telnet protocol responsibly and only for non-sensitive tasks. We recommend SSH, openssl, or nc for secure remote connections or encrypted service assessments.
By acknowledging telnet’s strengths and risks, you can use it effectively for specific scenarios while prioritizing secure alternatives for critical applications. Also, make sure you have proper authorization before using telnet to access remote servers or services.
If you have any questions about telnet or want to share how you use it, feel free to use the comment box below.
The telnet command in Linux is used for testing and troubleshooting network services by establishing a plain-text connection to a remote host. It helps verify if specific ports are open and whether services like SMTP, HTTP, and POP3 are responding as expected.
Telnet transmits data in plaintext, making it insecure, while SSH encrypts all communication to ensure data security. Telnet is usually used for basic debugging in controlled environments, whereas SSH is the preferred tool for secure remote server access and system administration.
No, telnet can’t test secure servers because it doesn’t support encrypted connections. Instead, use tools like openssl or nc to test servers running secure protocols, such as HTTPS or SMTPS, which require encryption.