Telnet is a free and open-source remote management protocol for Linux and Windows systems. It is used to check the remote server port connectivity from the client system. Telnet is also used to troubleshoot and test the system services that define the remote computing environment. Telnet is a client-server protocol that runs on port 23. Telnet can perform several helpful tasks for Linux and Windows administrators.
In this post, we will show you how to install and use Telnet in Debian 11.
Install Telnet Server in Debian 11
By default, Telnet is included in the default repository of all major Linux distributions. You can use the apt or dnf command to install Telnet in Linux.
For Ubuntu and Debian-based distributions, install the Telnet server using the following command:
apt-get install telnetd -y
Once the Telnet server is installed, check the status of the Telnet server with the following command:
systemctl status inetd
You should see the following output:
● inetd.service - Internet superserver Loaded: loaded (/lib/systemd/system/inetd.service; enabled; vendor preset:> Active: active (running) since Thu 2022-03-03 02:31:48 UTC; 49s ago Docs: man:inetd(8) Main PID: 657 (inetd) Tasks: 1 (limit: 2341) Memory: 580.0K CPU: 8ms CGroup: /system.slice/inetd.service └─657 /usr/sbin/inetd Mar 03 02:31:48 debian11 systemd[1]: Starting Internet superserver... Mar 03 02:31:48 debian11 systemd[1]: Started Internet superserver.
Log in to the Telnet Server from a Remote System
Generally, Telnet is used to log in to the remote server and perform administrative tasks.
Go to the remote system and run the following command to log in to the Telnet server:
telnet telnet-server-ip
You will be asked to provide your username and password to authenticate the Telnet server as shown below:
Trying 192.168.0.100... Connected to 192.168.0.100. Escape character is '^]'. Debian 11 LTS vyompc login: vyom Password:
Once you are logged in, you will get the following output:
Linux debian11 5.10.0-11-amd64 #1 SMP Debian 5.10.92-1 (2022-01-18) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Thu Mar 3 02:31:37 UTC 2022 from 103.1.103.89 on pts/0 vyom@vyompc:~$
You can now manage your server remotely via a command-line interface.
Also Read
How to Use Zip and Unzip Command in Linux
Check Open Ports on Remote System
Telnet is also useful to check open ports on the remote system.
For example, to test whether port 22 is open or not on the remote system, run the following command:
telnet remote-server-ip 22
If port 22 is open, you will get the following output:
Trying 192.168.1.2... Connected to 192.168.1.2. Escape character is '^]'. SSH-2.0-OpenSSH_7.4
If port 22 is not open or the service is not running, you will get the following output:
Trying 192.168.1.2... telnet: Unable to connect to remote host: Connection refused
To check whether the website test.example.com is open on port 80, run the following command:
telnet test.example.com 80
If port 80 is open, you will get the following output:
Trying test.example.com... Connected to test.example.com. Escape character is '^]'.
Now, run the following command to retrieve the index.html page from the website:
GET /index.html HTTP/1.0
Output:
HTTP/1.1 200 OK Date: Wed, 02 Mar 2022 10:22:16 GMT Server: Apache/2.4.29 (Debian) Last-Modified: Mon, 31 Jan 2022 07:25:23 GMT ETag: "2aa6-5d6dbb015179f" Accept-Ranges: bytes Content-Length: 10918 Vary: Accept-Encoding Connection: close Content-Type: text/html
Also Read
Netstat Command Line Tips and Tricks
Check a Remote Email Server
One of the best uses of the Telnet command is to check an email server.
For example, to check a remote email server, run the following command:
telnet mail-server-ip 25
Once the connection is successful, you will get the following shell:
Trying mail.example.com... Connected to mail.example.com. Escape character is '^]'. 220 vyompc ESMTP Postfix (Debian)
Now, run the ehlo followed by the email domain name to respond to the server:
ehlo example.com
You should see all methods supported by the email server:
250-vyompc 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-8BITMIME 250-DSN 250 SMTPUTF8
Now, run the following command to exit from the Telnet connection:
quit
Conclusion
In this post, we explained how to install and use Telnet on Debian 11. You can now use the Telnet command to check the remote port and email server status. Get started now on virtual private servers from Atlantic.Net!