Statement: Before you install and use Telnet, you need to keep the following points in mind. Using Telnet in a public network (WAN) is a very bad idea. It transmits log-in data in plaintext format. Clear text is visible to everyone. If you still need telnet, it is strongly recommended that you only use it inside the LAN. You can use SSH as a workaround. But be sure not to log in with the root user. What is Telnet?
Telnet is the protocol used to telnet to a computer over a TCP/IP network. Once a connection is made to the remote computer, it becomes a virtual terminal and allows you to communicate with the remote computer. In this tutorial, we will show you how to install Telnet and how to access the remote system via Telnet. Installation
Open the terminal and enter the following command to install Telnet: Yum Install Telnet telnet-server-y Telnet is now installed on your server. Next, edit the file/etc/xinetd.d/telnet: Vi/etc/xinetd.d/telnet Set 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 } Save and exit the file. Remember that we don't have to do this in CentOS 7. Next, use the following command to restart the Telnet service:
In the CentOS 6.x system: Service xinetd Start Let the service start on every reboot: On CentOS 6: Chkconfig Telnet on Chkconfig xinetd on On CentOS 7: Systemctl Start Telnet.socket Systemctl Enable Telnet.socket Allow Telnet to default port 23 through firewalls and routers. To make the Telnet port available through the firewall, edit the following file in the CentOS 6.x system: Vi/etc/sysconfig/iptables Add the following line "-A input-p tcp-m State--state NEW--dport 23-j ACCEPT": # Firewall configuration written by System-config-firewall # Manual Customization of this file are not recommended. *filter : INPUT ACCEPT [0:0] : FORWARD ACCEPT [0:0] : OUTPUT ACCEPT [0:0] -A input-m state--state established,related-j ACCEPT -A input-p icmp-j ACCEPT -A input-i lo-j ACCEPT -A input-p tcp-m state--state NEW--dport 23-j ACCEPT -A input-m state--state new-m tcp-p TCP--dport 22-j ACCEPT -A input-j REJECT--reject-with icmp-host-prohibited -A forward-j REJECT--reject-with icmp-host-prohibited COMMIT Save and exit the file. Restart the Iptables service: Service Iptables Restart In CentOS 7, run the following command to allow the Telnet service to pass through the firewall. Firewall-cmd--permanent--add-port=23/tcp Firewall-cmd--reload That's it. Now the Telnet service is ready to use. Create user
Create a test user, for example, the username is "SK" and the password is "CentOS": Useradd SK passwd SK Client Configuration To install the Telnet package: Yum Install Telnet In a Deb-based system: sudo apt-get install Telnet Now, open the terminal and try to access your server (remote host). If your client is a Linux system, open the terminal and enter the following command to connect to the Telnet server. Telnet 192.168.1.150 Enter the user name and password that you have created on the server: Example output: Trying 192.168.1.150 ... Connected to 192.168.1.150. Escape character is ' ^] '. Kernel 3.10.0-123.13.2.el7.x86_64 on an x86_64 Server1 Login:sk Password: [Email protected] ~]$ As you can see, the remote host has been successfully accessed locally. If your system is windows, go to start-to-run command prompt. At the command prompt, enter the command: Telnet 192.168.1.150 192.168.1.150 is the remote host IP address. |