How to Install Telnet on Debian 12, 11 or 10

Telnet, an enduring network protocol, facilitates users in establishing connections to remote devices, granting them the capability to manage and access resources on those systems. For those aiming to install Telnet on Debian 12 Bookworm, Debian 11 Bullseye, or Debian 10 Buster, it’s pivotal to grasp its functionalities and the scenarios where it remains relevant despite the advent of more secure protocols like SSH.

Key Features and Use Cases of Telnet:

  • Simplicity: Telnet’s straightforward nature makes it a go-to choice for basic remote access tasks, especially in environments where high-level security isn’t the primary focus.
  • Network Diagnostics: Its uncomplicated design helps swiftly pinpoint network-related issues and verify the status of services on distant hosts.
  • Development Utility: Telnet can be a handy tool for developers where encryption isn’t a prerequisite, offering a direct approach to work on network-centric applications.

However, it’s imperative to note that Telnet lacks encryption and authentication mechanisms, potentially leaving data transmissions vulnerable to unauthorized access and modifications. Thus, while Telnet can be advantageous in specific contexts, users must know its security limitations and consider more secure alternatives like SSH for critical operations.

This guide will provide an introduction and explanation on how to quickly install Telnet, along with some basic examples of Telnet terminal commands.

Update Debian Before Telnet Installation

Before installing Telnet, it is essential to ensure that your Debian operating system is current. Updating the system helps you get the latest security patches and package improvements. Run the following command to update and upgrade all existing packages on your system:

sudo apt update && sudo apt upgrade

Install Telnet via APT Command

Debian’s repositories provide the Telnet package by default, which can be easily installed using the apt package manager. To install the Telnet package, execute the following command:

sudo apt install telnetd 

After the installation, you should verify that the Telnet service is running correctly. Use the following command to check the status of the Telnet service:

systemctl status inetd

Test Telnet Connection on Debian

Once you have successfully installed Telnet, it’s time to test the connection. You must connect to your remote server using the Telnet protocol to do this. Execute the following command to establish a connection to the remote server (replace 192.168.50.15 with the IP address of your server):

telnet 192.168.50.15

If the connection is successful, you should see the Telnet prompt, allowing you to interact with the remote server. If you encounter any issues, verify that the Telnet service is running on the remote server and that the IP address is correct.

Example Telnet Commands

Connecting to a Remote Server

To establish a connection with a remote server using Telnet, replace <IP_ADDRESS> with the server’s IP address, and <PORT> with the appropriate port number:

telnet <IP_ADDRESS> <PORT>

For example, to connect to a server with an IP address of 192.168.50.15 on port 23, the default Telnet port, you would enter:

telnet 192.168.50.15 23

Step 2: Navigating the Telnet Interface

Once connected, you will be able to interact with the remote server. Some common commands you can use within the Telnet interface include:

Display current options: Use the display command to view the current options and settings:

display

Toggle local echo: Use the toggle command followed by local_echo to turn the local echo on or off:

toggle local_echo

Send escape character: Press the Ctrl + ] keys to send the Telnet escape character. This character is used to issue commands directly to the Telnet client instead of the remote server.

Closing the Telnet Connection

When you want to close the connection with the remote server, you have a few options:

Using the escape character: Press Ctrl + ] to send the escape character, then type quit and press Enter:

quit

Sending the logout command: Depending on the server’s configuration, you may be able to use the logout command to close the connection:

logout

Using Telnet to Check Services

Telnet can also be used to check if specific services are running on a server. For example, to test if an HTTP server is running on port 80, replace <IP_ADDRESS> with the server’s IP address:

telnet <IP_ADDRESS> 80

Once connected, type the following command to send an HTTP request:

GET / HTTP/1.1
Host: <IP_ADDRESS>
Connection: close

Replace <IP_ADDRESS> with the server’s IP address. If the HTTP server is running, you will receive an HTTP response.

Secure Telnet with UFW (Optional)

Install and Enable UFW

Uncomplicated Firewall (UFW) is a user-friendly front-end for managing iptables firewall rules. It is designed to simplify firewall configuration while maintaining the robustness of iptables. To install UFW on your Debian system, run the following command:

sudo apt install ufw

Once the installation is complete, enable the UFW with the following command:

sudo ufw enable

Set Default Policies

By default, UFW is set to deny all incoming connections and allow all outgoing connections. It is a good practice to configure these default policies explicitly. To do so, run the following commands:

sudo ufw default deny incoming
sudo ufw default allow outgoing

Allow Telnet Connections

To securely allow Telnet connections, you need to specify the IP addresses or subnets that are allowed to access your server via Telnet. Replace <ALLOWED_IP> with the IP address or subnet you want to grant access to:

sudo ufw allow from <ALLOWED_IP> to any port 23

For example, to allow connections from the IP address 192.168.1.10, you would run:

sudo ufw allow from 192.168.1.10 to any port 23

To allow connections from an entire subnet, such as 192.168.1.0/24, you would run:

sudo ufw allow from 192.168.1.0/24 to any port 23

Verify UFW Configuration

After setting up the firewall rules, verifying the configuration is correct is essential. To check the status of UFW and view the current rules, run:

sudo ufw status

Ensure that the output displays the correct rules for your Telnet service and that the allowed IP addresses or subnets are as intended.

Conclusion

In conclusion, we have covered installing Telnet on Debian Linux, from updating the system to testing the Telnet connection. Additionally, we have discussed common Telnet commands, examples, and how to secure the Telnet service using UFW as an optional security measure. Although Telnet has its uses, it’s important to remember that it’s not the most secure protocol for remote server access. Consider using a more secure alternative, like SSH, to protect your sensitive data and system whenever possible.

Leave a Comment