Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the telnet command in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use telnet command in Linux, Xiaobian thinks it is quite practical, so share it with you as a reference, I hope you can gain something after reading this article.

Linux common command telnet command is used to log in remote host, remote host management.

telnet login remote host and administration (test ip port connectivity)

Because telnet uses plaintext to transmit messages, security is not good, many Linux servers do not open telnet services, but switch to a more secure ssh mode. But there are still plenty of other systems that might use telnet to provide remote login, so it's still important to understand how telnet clients are used.

syntax telnet(option)(parameter) option-8: allows 8-bit character data, including input and output; -a: attempts to automatically log in to the remote system; -b: specifies the remote host name using an alias; -c: does not read.telnetrc files in the user-specific directory; -d: enables debugging mode; -e: sets the escape character; -E: filters out the escape character; -f: this parameter has the same effect as specifying the "-F" parameter; -F: When using Kerberos V5 authentication, add this parameter to upload authentication data of the local host to the remote host; -k: When using Kerberos authentication, add this parameter to make the remote host use the specified domain name instead of the domain name of the host; -K: Do not automatically log in to the remote host; -l: Specify the user name to log in to the remote host; -L: Allow 8-character data to be output; -n: Specify information about file records; -r: Use a user interface similar to the rlogin command; -S: Set ip TOS information required for telnet connections; -x: Use data encryption if the host supports it; -X: Turn off the specified authentication mode. Parameter Remote Host: Specify the remote host to log in for administration;

Port: Specifies the port number used by the TELNET protocol.

Example $ telnet 192.168.2.10 Trying 192.168.2.10... Connected to 192.168.2.10 (192.168.2.10). Escape character is '^]'. localhost (Linux release 2.6.18-274.18.1.el5 #1 SMP Thu Feb 9 12:45:44 EST 2012) (1) login: root Password: Login incorrect In general, root is not allowed to log in remotely. You can log in with a normal account first, and then use su -to switch to root.

$ telnet 192.168.188.132 Trying 192.168.188.132... telnet: connect to address 192.168.188.132: Connection refused telnet: Unable to connect to remote host

Is the IP address correct?

Confirm whether the host corresponding to ip address is powered on?

If the host has been booted, verify that the routing settings are set correctly? (Use route command to view)

If the host is up, verify that telnet is enabled on the host. (Use netstat command to see if TCP port 23 has a LISTEN status line)

If the host has started telnet service, verify that the firewall has released port 23 for access? (View with iptables-save)

Start telnet service

service xinetd restart configuration parameters, the usual configuration is as follows:

service telnet { disable = no #Enable flags = REUSE #socket reusable socket_type = stream #TCP connection wait = no #Start a process for each request user = root #The user who started the service is root server = /usr/sbin/in.telnetd #Process to activate log_on_failure += USERID #Log login username if login fails} If you want to configure the list of clients allowed to log in, join

only_from = 192.168.0.2 #Allow only 192.168.0.2 logins If you want to configure a list of clients that are prohibited from logging in, join

no_access = 192.168.0. {2,3,4} #Forbidden 192.168.0.2, 192.168.0.3, 192.168.0.4 Login If you want to set open hours, join

access_times = 9:00-12:00 13:00-17:00 #Only these two hours of the day are open (our working hours: P) If you have two IP addresses, one is a private network IP address such as 192.168.0.2, and the other is a public network IP address such as 218.75.74.83, if you want users to log in to telnet service only from the private network, then join telnet service.

bind = 192.168.0.2 For the specific meaning and syntax of each configuration item, please refer to the xined configuration file attribute description (man xinetd.conf).

Configure ports, modify services files:

# vi /etc/services find the following two sentences

telnet 23/tcp telnet 23/udp If there is a #character in front of it, remove it. The default port of telnet is 23, which is also the main object of hacker port scanning, so it is best to modify this port. The method of modification is very simple, that is, to modify the number 23 to a larger number, such as 61123. Note that port numbers below 1024 are reserved port numbers for the Internet, so it is best not to use them, and you should also be careful not to conflict with ports for other services.

Startup Services:

service xinetd restart About "Linux telnet command how to use" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report