What is telnet?

Telnet is the networking protocol used to administrate the remote linux or unix system. Telnet is an xined service. We must install the xinetd package and run the xinetd service to use the telnet process. To know more about Xinetd click here.

 

What are the limitations of telnet?

1. Telnet use plaintext to transmit the password because of this there is no security. Now a days for remote administration we are using ssh only.

2. Root user is not allowed to connect using telnet. To perform the administrative tasks we must do that through SUDO.

3. Telnet is a xinetd service. Xinetd service must be active in order to work on the telnet service.

 

Working of telnet:

  • Diagram representing the working of the telnet
  • Telnet client or server generally listens at port 23.
  • Whenever the login request is initiated by the client to the telnet server, the server listens the client request at port 23 in TCP.
  • The client will send the login credentials like username and password to the server in plain text mode, because of this only telnet is insecure.
  • Whenever the server received the credentials and authenticates the logins.
  • The connection has established between the client and server the client will send the commands and the server will send the outputs, verbose to the clients etc.,

 

How to configure the telnet in RHEL?

1. Check whether the telnet package installed or not and also check the xinetd package also.

#rpm –qa telnet-server
#rpm –qa xinetd

 

[root@sys2 ~]# rpm -qa telnet-server
[root@sys2 ~]# rpm -qa xinetd

 

The above commands returns nothing so, the packages are not installed.

2. Install the required package for telnet server.

#yum install telnet*
#yum install xinetd*

 

[root@sys2 ~]# yum install telnet*
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Package 1:telnet-0.17-47.el6_3.1.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package telnet-server.x86_64 1:0.17-47.el6_3.1 will be installed
--> Processing Dependency: xinetd for package: 1:telnet-server-0.17-47.el6_3.1.x86_64
--> Running transaction check
---> Package xinetd.x86_64 2:2.3.14-38.el6 will be installed
--> Finished Dependency Resolution Dependencies Resolved
===============================================================
Package              Arch        Version                    Repository         Size
===============================================================
Installing:
telnet-server       x86_64    1:0.17-47.el6_3.1     ithonors-repo    37 k
Installing for dependencies:
xinetd                  x86_64    2:2.3.14-38.el6         ithonors-repo    121 k
Transaction Summary
===============================================================
Install                2 Package(s)
Total download size: 158 k
Installed size: 313 k
Is this ok [y/N]:y--------------------------Press y to confirm the installation
Downloading Packages:
------------------------------------------------------------------------------------------------
Total 1.7 MB/s | 158 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 2:xinetd-2.3.14-38.el6.x86_64 1/2
Installing : 1:telnet-server-0.17-47.el6_3.1.x86_64 2/2
Verifying : 1:telnet-server-0.17-47.el6_3.1.x86_64 1/2
Verifying : 2:xinetd-2.3.14-38.el6.x86_64 2/2 Installed:
telnet-server.x86_64 1:0.17-47.el6_3.1
Dependency Installed:
xinetd.x86_64 2:2.3.14-38.el6
Complete!

 

In the above highlited output xinetd is the dependency which is installed during the installation of the telnet server.

3. Check the value in the configuration file of xinetd weather the telnet is enabled or not.

The configuration file for Xinetd is /etc/xinetd.d/telnet. Open the file and set “disable=no”

[root@sys2 ~]# vi /etc/xinetd.d/telnet
# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
flags              = REUSE
socket_type        = stream
wait               = no
user               = root
server             = /usr/sbin/in.telnetd
log_on_failure     += USERID
disable            = yes---------------Set this as no
}

 

4. To start the telnet service automatically at boot time the command is

#chkconfig telnet on
[root@sys2 ~]# chkconfig telnet on
[root@sys2 ~]# chkconfig --list telnet
telnet on

 

Restart the xinetd service.

# /etc/init.d/xinetd restart

 

5. Create a normal user in order to test the telnet.

>[root@sys2 ~]# useradd alex
[root@sys2 ~]# passwd alex
Changing password for user alex.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.

 

6. Check the ip address of the server machine.

[root@sys2 ~]# ifconfig –a
eth2 Link encap:Ethernet HWaddr 00:0C:29:F2:03:74
inet addr:192.168.1.29 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fdf7:da25:5322:0:20c:29ff:fef2:374/64 Scope:Global
inet6 addr: fe80::20c:29ff:fef2:374/64 Scope:Link
UP BROADCAST RUNNING MULTICAST    MTU:1500    Metric:1
RX packets:4103    errors:0    dropped:0    overruns:0    frame:0
TX packets:582     errors:0    dropped:0    overruns:0    carrier:0                            collisions:0             txqueuelen:1000
RX bytes:386352 (377.2 KiB) TX bytes:80813 (78.9 KiB)

 

The above highlighted part in the output is the server ipaddress.

7. Turn off the fire walls

[root@sys2 ~]# service iptables stop
iptables: Flushing firewall rules:                            [ OK ]
iptables: Setting chains to policy ACCEPT: filter             [ OK ]
iptables: Unloading modules:                                  [ OK ]
[root@sys2 ~]# /etc/init.d/iptables status
iptables: Firewall is not running.

 

Client side Configuration:

1. Check the telnet package is installed or not in the client machine if the client is linux.

[root@sys1 ~]# rpm -qa telnet
[root@sys1 ~]# yum install telnet*

 

2. Now login to the server by using the ip address of server as follows.

[root@sys1 ~]# telnet 192.168.1.29
Trying 192.168.1.29...
telnet: connect to address 192.168.1.29: Connection refused
Connection is refusing. Go to the server and set the selinux to permissive mode and try again.
[root@sys2 ~]# setenforce Permissive
[root@sys2 ~]# getenforce
Permissive

 

Now try to login

[root@sys1 ~]# telnet 192.168.1.29
Trying 192.168.1.29...
Connected to 192.168.1.29.
Escape character is '^]'.
Red Hat Enterprise Linux Server release 6.4 (Santiago)
Kernel 2.6.32-358.el6.x86_64 on an x86_64
login: alex
Password:
[alex@sys2 ~]$

 

Now we are successfully logged into the server by using the account of Alex.

 

If we are using the windows client:

• Simply go to control panel and click turn windows features on or off on programs and features option.

 

telnet1

 

Check the tick on telnet client and click OK

• Now go to cmd and try to access the telnet server.

 

telnet2

 

• Now on the command prompt >telnet 192.168.1.29

 

telnet3

 

After pressing enter to execute the command you will get the following window to access the remote server.

 

telnet4

 

 

telnet5

 

telnet6

 

Compare the above two screen shots and check the files are matched.

 

Topics Summary