Linux practice: Use SSH to remotely manage RHEL 5

Source: Internet
Author: User

Ssh is mainly used for remote management of linux. It transmits data encrypted and can be logged on to the remote computer as the root user. Assume that the server ssh service is enabled (enabled by default) and how to connect the client to a remote server. This example uses the following environment:

Ssh [user @] hostname [command]

> [User @]: user Name of the remote computer

> [Command]: The command directly executed after the connection is successful

> Sometimes, when you do not connect to the server through ssh, you can ~ /. Delete the content in ssh and try again.

Scp [user @] host:/path [-rpC]

> File copying between the ssh client and the server

>-R: Recursion

>-P: Retain the original file permission.

>-C: compressed data during transmission

> Rsync srcfile host:/path

To synchronize files between the client and the server, this command is one-time. If you need to regularly execute the command, you need to use the scheduled task. During synchronization, only srcfile TO host:/path

You need to enter the password of the remote computer every time you connect to the remote computer using ssh, which may be troublesome. You can use a key file to generate a key file on the local machine and copy the public key file to the remote computer again. You do not need to enter a password when you connect the private key file to the remote computer on the local machine.

> Of course, to ensure security, you can set a password for the private key file when generating the key pair. The password entered when you connect to the remote computer is the password of the private key file, rather than the user password of the remote computer. Of course, to facilitate saving the password of the private key file on a computer, you do not need to enter any password when connecting to a remote computer, however, if the private key file is copied to another computer, you still need to enter the password of the private key file. The configuration steps are as follows:

> Generate a key pair File

Copy the public key to a remote computer

Connect to the server again

Save the private key file to the Local Machine

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.