How to Install and Use Telnet on Debian 11 Bullseye

Telnet is a protocol that allows you to connect to remote computers (called hosts) over a TCP/IP network using a client-server protocol to establish a connection to Transmission Control Protocol port number 23

In the following tutorial, you will learn how to install Telnet on a Debian 11 Bullseye operating system.

Prerequisites

  • Recommended OS: Debian 11 Bullseye
  • User account: A user account with sudo privilages or root access (su command).
  • Required Packages: 

Updating Operating System

Update your Debian 11 operating system to make sure all existing packages are up to date:

sudo apt update && sudo apt upgrade

Root or Sudo Access

By default, when you create your account at startup with Debian compared to other distributions, it does not automatically receive sudoers status. You must either have access to the root password to use the su command or visit our tutorial on How to Add a User to Sudoers on Debian.


Advertisement


Warning

The tutorial will show you how to install Telnet for historical purposes and use in local environments, isolated networks. It is highly recommended not to use Telnet on an open network connection to the Internet because the data is sent over the connection, including sensitive information such as passwords and other confidential information that is not encrypted so the data can be easily intercepted by a hacker and misused. To safely connect to remote servers over public networks, you should always use SSH (Secure Shell).

Install Telnet Server

By default, Debian 11 repositories come with Telnet package available to install using the apt package manager.

First, use the following command to install:

sudo apt install telnetd 

Example output:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  openbsd-inetd tcpd
The following NEW packages will be installed:
  openbsd-inetd tcpd telnetd
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 106 kB of archives.
After this operation, 330 kB of additional disk space will be used.
Do you want to continue? [Y/n] 

Type “Y,” then press the “ENTER KEY” to proceed with the installation.

Once installed, check to make sure Telnet status is operating ok with the following:

sudo systemctl status inetd

Example output:

● inetd.service - Internet superserver
     Loaded: loaded (/lib/systemd/system/inetd.service; enabled; vendor preset:>
     Active: active (running) since Thu 2021-09-30 13:37:35 AWST; 2s ago
       Docs: man:inetd(8)
   Main PID: 16375 (inetd)
      Tasks: 1 (limit: 4626)
     Memory: 576.0K
        CPU: 2ms
     CGroup: /system.slice/inetd.service
             └─16375 /usr/sbin/inetd

Sep 30 13:37:35 debian systemd[1]: Starting Internet superserver...
Sep 30 13:37:35 debian systemd[1]: Started Internet superserver.
lines 1-13

Advertisement


Connect to your Telnet Server

Optional. Set UFW Rule

Firstly, if you have UFW installed to connect to your remote running Telnet, you will need to set up an allow rule. By default, Telnet runs on port 23.

To set up an allow rule in UFW can be done in several ways. It is highly recommended to give the IP of the connecting server only if at significantly worse the subnet. Do not leave port 23 open to everything, and this will lead to brute force attempts.

The rule for single IP:

sudo ufw allow from 192.145.50.33 to any port 23

Allow from subnet:

sudo ufw allow from 192.145.50.0/24 to any port 23

Test Connection

Now that you have set up a UFW rule so you can connect to your remote server using Telnet, use the following (Telnet) command:

telnet 192.168.50.15

Example output:

How to Install and Use Telnet on Debian 11 Bullseye

Uninstall Telnet Server

To remove Telnet off your Debian operating system, all you need to do is use the following command:

sudo apt autoremove telnet --purge

Example output:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  openbsd-inetd tcpd telnetd
0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
After this operation, 330 kB disk space will be freed.
Do you want to continue? [Y/n] 

Type “Y,” then press the “ENTER KEY” to proceed with the uninstall.


Advertisement


Comments and Conclusion

You have learned how to install, set up a firewall rule, and connect to a remote server using Telnet in the tutorial. Overall, in today’s world, the most secure form of communication of this nature is to use SSH instead of Telnet. However, development environments that run on remote local networks Telnet can be more helpful. Still, you would never run Telnet in a public network these days, and it would open your server up to a very high risk in doing so.

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x