Linux telnet Command
In Linux, the telnet command is used to create a remote connection with a system over a TCP/IP network. It allows us to administrate other systems by the terminal. We can run a program to conduct administration.
It uses a TELNET protocol. However, this protocol has some security defects, but it is one of the most used networking protocols due to its simplicity. It is not a secure protocol because it transfers data in unencrypted form. Often Linux user prefers ssh over telnet because ssh transfers data in encrypted form. This utility is similar to the Remote Desktop feature in Windows. The syntax for the telnet is as Follows:
Install Telnet on Linux (Ubuntu)
Installing telnet on Linux is a straight forward process. We can install it by executing the following commands:
Update the Linux system by executing the below command:
The above command will prompt for the user password. Type the password and press ENTER key; it will start a daemon process and take a while to update your system.
To install the telnet, execute the below command:
The above command will install the required package for the telnet protocol. Consider the below output:
To verify the installation and whether the service is running or not, execute the below command:
Consider the below output:
Now, we have to open port23 in the ufw firewall. Execute the below command:
The above command can only be executed by the root user. If you are not a root user, use sudo before this command. Consider the below output:
The next step is to reload the firewall to apply the changes. To reload the firewall, execute the below command:
Now, we have successfully installed the telnet in our machine.
Start Telnet shell
The interactive shell can be started by executing the telnet command as follows:
This shell allows us to execute some commands exclusive for telnet. It will look like the below snap:
The shell facilitates with various commands to create a remote connection. We can list all the commands by executing the help command, execute the help command by typing h. Consider the below output:
As from the above snap of shell, all commands are listed with their usage. There are many command-line utilities listed such as close, logout, display, mode, open, quit, send, and more.
How to connect by telnet command in Linux?
To create a connection between two systems by telnet command is a simple process, execute the telnet command followed by the hostname.
For example, we are connecting our system with the localhost. Execute the command as follows:
The above command will ask for the user name and password, enter the credential to proceed. Consider the below output:
After connecting, we can execute the commands as done before. The only difference is that now the machine is treated as a remote machine.
To exit the telnet command, execute the logout command.
consider the below output:
Now we have successfully logged out from the remote connection.