Categories: TutorialsUbuntu

How to Install Telnet Server and Client on Ubuntu

Telnet is a network protocol used for connecting to remote systems through a command-line interface. It can be used to configure remote devices such as routers, switches, servers, etc. Telnet can also be used to test if a TCP port on a remote system is open or not.

In today’s guide, we will install the Telnet server and client on Ubuntu. We will be using the two Ubuntu 20.04 LTS machines. On one Ubuntu machine, we will install Telnet server. On another Ubuntu machine, we will install the Telnet client. Then we will connect to the Telnet server using the Telnet client.

Sponsored

Note: Telnet is not a secure protocol because the Telnet session between server and client is unencrypted. You can use it for testing the connectivity to TCP ports. However, for connecting to the remote system, it is recommended to use SSH.

Installing Telnet Server on Ubuntu

Ubuntu default repository contains the Telnet server package. Therefore, it can be simply installed with the apt command. On one Ubuntu machine, install Telnet server by running the command below in the Terminal:

$ sudo apt install telnetd xinetd

After running the above installation command, Terminal might prompt you with the y/n option. To continue the procedure, hit y and then hit Enter. It will then install the Telnet server and xinetd on your Ubuntu system.

After installation, the xinetd service starts automatically. You can view the status of the service as follows:

$ sudo systemctl status xinetd.service

If the service does not start automatically, you can manually start it by running the command below:

$ sudo systemctl start xinetd.service

Now create the /etc/xinetd.d/telnet file using the command below:

$ sudo nano /etc/xinetd.d/telnet

Add the below lines the file:

service telnet

{

disable = no

flags = REUSE

socket_type = stream

wait = no

user = root

server = /usr/sbin/in.telnetd

log_on_failure += USERID

}


Then save and close the file and restart xinetd.service as follows:

$ sudo systemctl restart xinetd.service

Telnet server uses port 23 for listening to the incoming connections. Therefore, you will need to open this port in your firewall. Run the command below to do so :

$ sudo ufw allow 23

To allow incoming connections to port 23 from only a specific IP or subnet, run the below command instead:

Sponsored
$ sudo ufw allow from  to any port 23

Installing Telnet Client on Ubuntu

Telnet client is also available in the Ubuntu repository. On your second Ubuntu machine, run the command below in Terminal to install the Telnet client.

$ sudo apt install telnet

After running the above installation command, Terminal might prompt you with the y/n option. To continue the procedure, hit y and then hit Enter. It will then install the Telnet client on your Ubuntu system.

Connect to Telnet Server from Remote System

Now you can connect to your Telnet server from another machine (where the Telnet client is installed). On your client machine, use the following command syntax to connect to the Telnet server:

$ telnet 

Where is the IP address of the Telnet server.

Uninstall Telnet Server and Client

If for any reason you want to uninstall Telnet server and client from your Ubuntu machine, you can do so as described below.

To uninstall Telnet server, run this command:

$ sudo apt remove telnetd xinetd

To uninstall Telnet client, run this command:

$ sudo apt remove telnet

After running the above commands, Terminal might prompt you with the y/n option. To continue the procedure, hit y and then hit Enter. It will then remove the applications from your Ubuntu system.

By following the method explained above, you can easily install the Telnet server and client on your Ubuntu systems. We have also shared the method to uninstall the Telnet server and client from Ubuntu in case you need to remove it.

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.

Ubuntu Server Admin

Recent Posts

How to Install and Use Zig Programming Language on Ubuntu or Debian Linux

In this article, we will see how to install and use zig programming language on…

31 minutes ago

Linux Sed Tutorial: Learn Text Editing with Syntax and Examples

This article was adapted from its original version on NixCraft. Sed is an acronym for…

6 hours ago

How to Fix VMware’s “Could not open /dev/vmmon” Error on Ubuntu

You’ve recently installed VMware Workstation on your Ubuntu system and encountered the frustrating “Could not…

14 hours ago

How to Fix Ubuntu 404 Errors While Fetching Dependencies

Have you ever found yourself staring at a terminal full of 404 errors while trying…

14 hours ago

How to Fix ‘Please Install All Available Updates’ Error When Upgrading Ubuntu 18.04 to 20.04 LTS

One particularly frustrating error that many users face when trying to upgrade from Ubuntu 18.04 …

14 hours ago

How to fix “Release is not valid yet” Error in Docker Containers

In the world of containerization, time synchronization issues can create unexpected roadblocks when working with…

14 hours ago