, , , , ,

–Telnet server in Linux–

Telnet (Terminal Network) is a network protocol that provides a virtual text-based command line interface at a remote location on a remote computer.telnet is a bidirectional network protocol means one can send and receive information using telnet.Telnet is a text- only protocol means you won’t see graphics or fancy images while working with Telnet, nor will you be able to transfer files with Telnet.

telnet server in linux

Note:- This configuration properly works on Rhel4, Rhel5, Rhel6,Rhel7, centOS(5,6,7) & Fedora.

step by step procedure of telnet configuration==>

step 1

first of all we have to install .rpm package for telnet.To view telnet package in redhat package manager(rpm) use below command

#rpm -qa | grep telnet

telnet server

step 2

so as you see we have two package related to telnet. now to install these packages we will use yum (yellowdog updater modified).If you don’t know how to install a package using yum then first read ==>yum server configuration in Linux

use below command to install telnet ==>

telnet in linux
explanation of above command–>

-y ==> if you use this option then during installation no yes/no check will be asked.

telnet* ==> all package related to telnet will be installed at once.

step 3

now go to telnet configuration file ==>vim /etc/xinetd.d/telnet

now in this file you have to modify last line (disable = yes)
>modify last line as ==>

disable = no


>>now use esc:wq to save this file.

step 4

now we have to restart telnet service. use below commands to restart telnet service ==>

telnet tricks
(here we use chkconfig xinetd on command to make telnet service parmanent on your pc)

So now we successfully installed telnet service on our linux system. Now we have to do telnet on client or target PC. So let’s dive into the second part of the article==>

(how to use telnet in linux)
(telnet login as general user on client pc)

if you want to do telnet on any computer then the client pc must be in your wifi network or it must connected to your PC in LAN.
remember some important points before doing telnet on target pc–>

>you need ip address of target pc
>telnet port must be open on target pc. to check telnet port is open or not on target pc use nmap tool
>to install nmap in linux simply use below command

#yum install nmap*

>to check which port in open on client pc==>nmap  ip-address of target pcnmap
>so as you see telnet port is open on the client pc
>firewall and selinux must be off or disabled on client pc for telnet.
>to flush firewall just use command==> iptables -F (it will remove all firewall settings)
>to disable selinux use command ==> setenforce 0 (it will permit telnet on target PC)
to view selinux status use command ==> getenforce

telnet firewal selinux

Let’s do Telnet on client Pc

now we are ready to do telnet on our target or client pc ==>
Step 1>> use command ==>

telnet (ip-address of client pc)

for ex. #telnet

telnet on target
now it will ask for username and password so just input correct username and password.
for e.g. username shankar
password ******


Step2>>now you are on client pc. To check it use below commands
who am i

Step3>>to get out from client pc use command ==> exit


(how to login as root user of client pc)

we can’t login as root user on client PC because by default no extra port is open for remote connections using telnet or ssh. So we have to manually add ports on target PC .

How to add ports manually on client pc for root user login??

>On client pc go to below file==> vim /etc/securetty
(securetty file contains all the ports for login purposes)

>now we manually add some ports at the end of this file.

> add pts/1, pts/2, pts/3 etc



(with the help of these additional ports we can easily login into target or client pc as root user)
>now save the file ==> esc:wq
>>thats it , now we are ready to login as root user on client pc
>Now use command ==>

telnet (ip-address of target pc) 


telnet in rhel5
> so now you are login on target PC as a root user. Now the target PC is in your full control, you can shutdown target pc ,add partitions and do every and each function that a root user can do on a Linux system.

How to login to a specific user using telnet service

if you know the username and ip address of a target or client pc then you can directly log in into the target pc using below command==>

#telnet -l username@ip-address



Some important help commands while doing telnet on target pc==>

telnet help

how to stop or disable telnet service

>>since as we all know that telnet is not secure so its better to turn off telnet service on your PC. To turn off telnet service in red hat Linux follow below steps–>

>go to terminal and use command==> vim /etc/xinetd.d/telnet
now your telnet configuration file will open. In this file set disable = yes and save the file.

>to stop telnet service use following commands==>

#service xinetd stop
#chkconfig xinetd off

>you can also use firewall rule to block telnet

#iptables -t filter -A INPUT -s -P telnet -j DROP

>use can also use tcpwrapper to block or disable telnet service.

>you can also remove telnet server package by using below command==>

#yum remove telnet-server

(Telnet is not secure)

>The one thing you must know about Telnet is that it is not a secure protocol. When you log into a remote pc using Telnet, your username and password are sent in plain text. Means they are not encrypted so if a person is using network analyzer tool in a network then by analyzing packets it will get your username and password very easily.So that’s how telnet is not secure. due to these security flaws telnet is replaced by more secure ssh protocol

configure telnet for secure remote login (secure telnet server)

now we learn how to configure telnet for secure remote login. As we know there  are many security flaws in telnet but still we can configure port based security on our telnet  server. So now if a user knows ip -address of your PC and want to do telnet on  your secure telnet configured PC then he will be not able to login to your PC because it requires both ip -address and port to login through secure telnet server.

Secure Telnet Server Configuration

Step 1 

copy telnet configuration file to another file name stelnet .

#cp  /etc/xinetd.d/telnet  /etc/xinetd.d/stelnet


step 2

Now go to /etc/xinetd.d/stelnet and make changes in it .Now change service from telnet to stelnet, and change disable from yes to no and add port number manually to 8888.



 Step 3

now we have to add this port no 8888 manually to our Linux machine. Go to /etc/services file and make the entry of port.

#vim /etc/services



Step 4

Now simply restart the xinetd service after making above changes.

#service xinetd restart

Step 5

now we will test our telnet login through the port 8888 ==>


so its clear that a user need both ip address and port to login through secure telnet. So that’s how we can add port based security to our telnet server and made it secure from unwanted attacks and hacks.


today in this article we have learned that how to configure telnet server in Linux and how to telnet through general user and root user and how to secure our Linux server by assigning port security to it.

>don’t forget to rate this article and follow us for more interesting Linux articles. please give feedback in comment section so that we will help you more  and make better articles.

Stay tuned ! complete tutorial on ssh server in Linux coming soon !