How to install and configure telnet on Linux

Home > Search > How-to
  by

Word of warning. Telnet should only be used on private networks which are inaccessible from the Internet, because telnet does not encrypt traffic. When making a connection to a remote server over the Internet, use SSH.

There are two components needed to make a telnet connection on Linux, a telnet client and a telnet server. Depending on the Linux distro you are using, you will use either apt-get or yum to install the telnet client and the telnet server. Install the telnet client on the machine you want to make the connection from. Install the telnet server on the machine you want to connect to.

[root@server1 ~]# apt-get install telnet
[root@server1 ~]# yum install telnet
[root@server1 ~]# apt-get install telnet-server
[root@server1 ~]# yum install telnet-server

 

Telnet uses the xinetd daemon.  If xinetd is not installed, install xinetd.

[root@server1 ~]# apt-get install xinetd
[root@server1 ~]# yum install xinetd

 

At /etc/xinetd.d/ should be a few files.  We need to edit the telnet file. If /etc/xinetd.d/ does not contain a file named telnet, create the telnet file.

[root@server1 ~]# touch /etc/xinetd.d/telnet

 

Edit the telnet file so that the telnet file contains this information.

service telnet {
 flags           = REUSE
 socket_type     = stream
 wait            = no
 user            = root
 server          = /usr/sbin/in.telnetd 
 log_on_failure  += USERID
 disable         = no 
}

 

Restart the xinetd service.  Also, if you have security on the server, such as firewall or SELinux or /etc/hosts.deny, you will need to modify security to allow connections on the default telnet port 23.

[root@server1 ~]# service xinetd restart

 

Configure the service to always be on, even after a reboot.

[root@server1 ~]# chkconfig xinetd on

 


Now we can turn over to the client.  Install telnet on the client.

apt-get install telnet
yum install telnet

 

We can now attempt to connect to the telnet server. In this instance, let's say the telnet-server has ip address 192.168.0.77. 

telnet 192.168.0.77

 

You will be prompted to sign in with a username and password.  Telnet does not allow you to sign in as root.  Instead, you will need to sign in using a non-root account.  To disconnect from the telnet server, type logout.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments