Sunday, 11 May 2014

Install and configure Telnet Server in Linux

Telnet service is to provide a text-oriented communications and this service is used on internet/LAN using a virtual terminal connection. Telnet by default uses 23 port number. We will use telnet server installation and configurations on CentOS 6 / Red Hat family as this service is also applicable and works to fedora distribution environment.
IP Configuration ( My Server IP address is 172.16.41.82 )

Telnet Server Configuration

Open Terminal and login as root user.
Install Telnet server using yum.
[root@linuxpathfinder /]# yum install telnet telnet-server

Setting up Install Process
 Resolving Dependencies
 --> Running transaction check
 ---> Package telnet.i686 1:0.17-47.el6_3.1 will be installed
 ---> Package telnet-server.i686 1:0.17-47.el6_3.1 will be installed
 --> Processing Dependency: xinetd for package: 1:telnet-server-0.17-47.el6_3.1.i686
 --> Running transaction check
 ---> Package xinetd.i686 2:2.3.14-39.el6_4 will be installed
 --> Finished Dependency Resolution

Dependencies Resolved
==================================================================
 Package               Arch     Version           Repository Size
 =================================================================
 Installing:
 telnet               i686     1:0.17-47.el6_3.1  base       57 k
 telnet-server        i686     1:0.17-47.el6_3.1  base       36 k
 Installing for dependencies:
 xinetd               i686     2:2.3.14-39.el6_4  updates    122 k

Transaction Summary
 =================================================================
 Install       3 Package(s)

Total download size: 215 k
 Installed size: 413 k
 Is this ok [y/N]:

Press [y] to complete the installation.

Installed:
 telnet.i686 1:0.17-47.el6_3.1
 telnet-server.i686 1:0.17-47.el6_3.1

Dependency Installed:
 xinetd.i686 2:2.3.14-39.el6_4

Complete!
Need to configure telnet server, go to the directory /etc/xinetd.d to change configuration.
[root@linuxpathfinder /]# cd /etc/xinetd.d
Using vim editor to edit the telnet file.
[root@linuxpathfinder xinetd.d]# ls

chargen-dgram   daytime-dgram   discard-dgram   echo-dgram   tcpmux-server  time-dgram
 chargen-stream  daytime-stream  discard-stream  echo-stream  telnet   time-stream
Change option ‘disable = yes’ to ‘disable = no’.
 # 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         = no
 }
Restart the service after change in the file and permanently save the changes by using chkconfig option.
[root@linuxpathfinder xinetd.d]# service xinetd restart

Stopping xinetd:              [  OK  ]
Starting xinetd:              [  OK  ]

[root@linuxpathfinder xinetd.d]# chkconfig xinetd on
Check out the firewall settings for further configuration:
[root@linuxpathfinder /]# setup
telnet-server-01
Enable the firewall settings and add telnet port 23 and Protocol is tcp.
telnet-server-02telnet-server-03telnet-server-04telnet-server-05telnet-server-08
Again restart the xinetd service after firewall settings.
[root@linuxpathfinder /]# service xinetd restart


Telnet Client Configuration

On the client end, you have to know the IP address of the remote server to access via telnet remotely. Remote communication with Telnet is insecure between server and client. For the secure communication use ssh service as explained already in previous tutorials.
Open Terminal and use the command telnet <server ip address>
Now put the username and password to access the remote system. (Login name : asifark)
Note : You cannot directly login as a super user in telnet.
[root@linux-server ~]# telnet 172.16.41.82

Trying 172.16.41.82...
 Connected to 172.16.41.82.
 Escape character is '^]'.
 CentOS release 6.4 (Final)
 Kernel 2.6.32-358.18.1.el6.i686 on an i686
 login: asifark
 Password:
 Last login: Wed Sep 30 14:44:14 from 172.16.41.82
 [asifark@linuxpathfinder ~]$ ls
 history_file.txt
 [asifark@linuxpathfinder ~]$ logout
 Connection closed by foreign host.
 [root@linux-server ~]#

1 comment: