Telnet is a terminal emulation program for TCP/IP networks that allows you to access another computer on the Internet or local area network by logging in to the remote system. Telnet is a client-server protocol used to establish a connection to Transmission Control Protocol port number 23. You can also check open ports on a remote system using Telnet.
In this tutorial, we will learn how to install and use Telnet on Ubuntu 18.04 LTS server.
WARNING: Telnet is an unencrypted and therefore insecure protocol. This tutorial exists for educational reasons only and not as a recommendation to use Telnet Server on your system. This guide shows you how to install and use Telnet client and server in case you are interested in learning more about that ancient server management protocol or in case you want to use Telnet client to test your mail server. We do NOT recommend to use Telnet (Server) on servers today, especially not when using it over the internet. To manage your server over the network, use SSH instead of Telnet. Using Telnet client is something different, a telnet client is a useful tool to e.g. test your mail or web server as shown below.
- A server running Ubuntu 18.04 server.
- A non-root user with sudo privileges.
- A static IP address 192.168.0.100 configure on your server.
Install Telnet Server
By default, Telnet server package is available in the Ubuntu 18.04 default repository. You can install it by just running the following command:
sudo apt-get install telnetd -y
Once the installation is completed, you can check the status of Telnet service using the following command:
sudo systemctl status inetd
? inetd.service - Internet superserver Loaded: loaded (/lib/systemd/system/inetd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2018-10-08 15:34:15 UTC; 38s ago Docs: man:inetd(8) Main PID: 2883 (inetd) Tasks: 1 (limit: 1114) CGroup: /system.slice/inetd.service ??2883 /usr/sbin/inetd Oct 08 15:34:15 ubuntu1804 systemd: Starting Internet superserver... Oct 08 15:34:15 ubuntu1804 systemd: Started Internet superserver.
Test Telnet Connection from Remote System
Telnet server is now installed and listening on port 23. It's time to connect Telnet server from the remote system.
Now, log in to other Ubuntu system and run the following command:
You will be asked to enter your username and password. After successfull authentication, you should see the following output:
Trying 192.168.0.100... Connected to 192.168.0.100. Escape character is '^]'. Ubuntu 18.04 LTS ubuntu1804 login: hitesh Password: Last login: Mon Oct 8 15:41:31 UTC 2018 from localhost.localdomain on pts/2 Welcome to Ubuntu 18.04 LTS (GNU/Linux 4.15.0-20-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Mon Oct 8 15:46:19 UTC 2018 System load: 0.0 Processes: 108 Usage of /: 81.7% of 7.81GB Users logged in: 2 Memory usage: 28% IP address for enp0s3: 192.168.0.100 Swap usage: 0% * Security certifications for Ubuntu! We now have FIPS, STIG, CC and a CIS Benchmark. - http://bit.ly/Security_Certification * Want to make a highly secure kiosk, smart display or touchscreen? Here's a step-by-step tutorial for a rainy weekend, or a startup. - https://bit.ly/secure-kiosk 187 packages can be updated. 88 updates are security updates. [email protected]:~$
You can now run any command on Telnet server using Telnet.
Use telnet to Test Open Ports
You can also use Telnet to test open ports on a remote system.
For example, to test port 80 on the remote system (IP 192.168.0.100) run the following command:
telnet 192.168.0.100 80
If the port 80 is open, you should see the following output:
Trying 192.168.0.100... Connected to 192.168.0.100. Escape character is '^]'.
If the port 80 is blocked or service is not running. You should see the following output:
Trying 192.168.0.100... telnet: Unable to connect to remote host: Connection refused