Telnet is a network protocol used to provide a bidirectional interactive text-oriented communication facility using a virtual terminal connection. Here’s how you can install and use Telnet on a Linux system. I had to take a long walk in NYC before taking on this one. I assumed Telnet was no longer in use by anybody.

Installing Telnet

The process of installing Telnet depends on the Linux distribution you are using. Here are the commands for some common distributions:

For Debian/Ubuntu-based distributions:

sudo apt update
sudo apt install telnet

For Red Hat/CentOS-based distributions:

sudo yum install telnet

For Arch Linux:

sudo pacman -S inetutils

Using Telnet in Linux

After installing Telnet, you can use it to connect to remote servers. Here are some common uses:

Basic Telnet Command

To connect to a remote server, use the following syntax:

telnet [hostname or IP address] [port]

For example, to connect to example.com on port 80:

telnet example.com 80

Example Usage

  1. Connecting to a Remote Server:
   telnet example.com 80

If the connection is successful, you will see a blank screen or some welcome message from the server.

  1. Testing a Mail Server:
    You can use Telnet to test an SMTP mail server:
   telnet smtp.example.com 25

Once connected, you can type SMTP commands such as HELO, MAIL FROM, RCPT TO, and DATA to interact with the mail server.

  1. Checking an Open Port:
    Telnet can be used to check if a particular port is open on a server:
   telnet yourserver.com 22

If the port is open, you will connect to it, otherwise, you will get a connection error.

Closing a Linux Telnet Session

To close a Telnet session, you can type exit or quit, or you can simply press Ctrl+] to escape to the Telnet prompt and then type quit to exit.

Ctrl + ]
telnet> quit

Telnet Commands and Options

  • open [hostname] [port]: Open a connection to the specified hostname and port.
  • close: Close the current Telnet session.
  • quit: Exit the Telnet client.
  • status: Print status information.
  • ? or help: Display help information.

Security Note

Telnet is not a secure protocol as it transmits data in plaintext, including usernames and passwords. For secure remote access, it is recommended to use SSH (Secure Shell) instead of Telnet.

To install SSH on a Linux system:

For Debian/Ubuntu-based distributions:

sudo apt update
sudo apt install openssh-client

For Red Hat/CentOS-based distributions:

sudo yum install openssh-clients

For Fedora:

sudo dnf install openssh-clients

For Arch Linux:

sudo pacman -S openssh

To connect to a remote server using SSH:

ssh user@hostname

By following these instructions, you should be able to install and use Telnet on your Linux system. Remember to consider using more secure alternatives like SSH for sensitive communications.

Leave a comment

Your email address will not be published. Required fields are marked *