Telnet and execute remote host commands for Linux commands

Source: Internet
Author: User
Tags ssh server telnet program

Commands to implement Telnet

SSH, Telnet, rlogin

(1) SSH

The SSH command is the Client Connection tool in the OpenSSH suite, which enables secure Telnet server to SSH encryption protocol. The SSH command is used to telnet to the Linux host.

Common format:ssh [-l login_name] [-P port] [[Email Protected]]hostname
More details can be viewed with ssh-h.

Grammar:

SSH (options) (parameters)

Options:

-1: Enforce SSH protocol version 1;-2: Enforce SSH protocol version 2;-4: Force the use of IPV4 address;-6: Force the use of IPV6 address;-A: Turn on the authentication agent connection forwarding function;-A: Turn off the authentication agent connection forwarding function; B: Use the local designated address as the source IP address of the corresponding connection;-C: Request to compress all data;-F: Specify the configuration file for SSH instruction;-f: SSH command in the background;-G: Allow the remote host to connect to the host's forwarding port;-I: Specify identity file;-L: Specify the remote server login user name ;-N: Do not execute remote instruction;-o: Specify configuration options;-P: Specify the port on the remote server;-Q: Silent mode;-X: Turn on the X11 forwarding function;-X11 forwarding function;-y: Turn on trust X11 forwarding.

Parameters:

Remote Host: Specifies the remote SSH server to which you want to connect; Directives: instructions to be executed on the remote SSH server.

Example:

Do not specify User:

SSH 192.168.0.11

Specify User:

ssh-l root 192.168.0.11ssh [email protected]

If you have modified the SSH login port, you can:

Ssh-p 12333 192.168.0.11ssh-l root-p 12333 216.230.230.114ssh-p 12333 [email protected]

In addition to modify the configuration file/etc/ssh/sshd_config, you can change SSH login port and disable root login. The port can be changed to prevent the port from being scanned.

To edit a configuration file:

Vim/etc/ssh/sshd_config

Locate #port 22, remove the comment, and modify it to a five-bit port:

Port 12333

Find #permitrootlogin Yes, remove the comment, and modify it to:

Permitrootlogin No

To restart the SSHD service:

Service sshd Restart

When you use SSH to log on to a remote host from your computer, you may want to switch to local operations and then back to the remote host. At this point, you don't need to interrupt the SSH connection, just follow the steps below:

To temporarily return to the local host, enter the exit symbol: "~" and "control-z" combination. When you enter "~" You will not see it immediately on the screen, when you press <Control-Z> and press ENTER to display it together.

(2) Telnet

Telnet commands are usually used to log on remotely. The Telnet program is a telnet protocol-based Telnet client program. To start a Telnet session, you must enter a user name and password to log on to the server. Telnet is a common way to remotely control a Web server. However, Telnet is not secure because it transmits messages in plaintext, and many Linux servers do not open the Telnet service, instead using a more secure SSH approach. However, there are still many other systems that may use Telnet to provide remote logins, so it is still necessary to figure out how to use the Telnet client. The Telnet command can also be used for other purposes, such as determining the status of a remote service and determining whether a port on a remote server can be accessed.

Command format:

telnet[parameters [Host]

Command function:

Perform the Telnet command to open the terminal stage job and log in to the remote host.

Command parameters:

-8 allows the use of 8-bit character data, including input and output. -a attempts to automatically log in to the remote system. -b< host aliases > Use aliases to specify the remote host name. -C does not read the. telnetrc file in the user-specific directory. -D start the debug mode. -e< out character > set out character. -e filters out the off character. -F The effect of this parameter is the same as specifying the "-F" parameter. -F with Kerberos V5 authentication, this parameter can be used to upload authentication data from the local host to the remote host. -k< domain name > When using Kerberos authentication, this parameter allows the remote host to take the specified realm name rather than the domain name of the host. -K does not automatically log in to the remote host. -l< User name > Specifies the name of the user to log in to the remote host. -L allows output of 8-bit character data. -n< log Files > specify information about file records. -R uses a user interface similar to the rlogin directive. -s< Service Type > set the IP TOS information required for Telnet connection. -X assumes that the host has the capability to support data encryption and uses it. -x< Authentication Pattern > Close the specified authentication pattern.

Example:

Normal Telnet

Telnet 192.168.120.204

Output:

[[Email protected] ~]# telnet 192.168.120.204Trying 192.168.120.204...Connected to 192.168.120.204 (192.168.120.204). Escape character is ' ^] '.    localhost (Linux release 2.6.18-274.18.1.el5 #1 SMP Thu Feb 9 12:45:44 EST) (1) Login:rootPassword:Login incorrect

Note: in general, Root is not allowed to log in remotely, you can login with a regular account, and then use Su-cut to the root user.

Telnet and execute remote host commands for Linux commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.