Copy files between two Linux Hosts using scp

Source: Internet
Author: User

To establish a security trust relationship between the root of the Client and the root of the Server, follow these steps:

1. Run the ssh-keygen command on the Client to generate a certificate that establishes a security trust relationship.

[Root @ Clientroot] # ssh-keygen-B 1024-t rsa

Generatingpublic/private rsa key pair.

Enter file inwhich to save the key (/root/. ssh/id_rsa ):

Enter passphrase (empty for no passphrase): <-- press Enter

Enter samepassphrase again: <-- press Enter.

Youridentification has been saved in/root/. ssh/id_rsa.

Your public keyhas been saved in/root/. ssh/id_rsa.pub.

The key fingerprintis:

49: 9c: 8a: 8f: bc: 19: 5e: 8c: c0: 10: d3: 15: 60: a3: 32: 1croot @ Client

[Root @ Clientroot] #

Note: When the program prompts you to enter passphrase, enter the carriage return, indicating no certificate password.

The above command generates the Private Key Certificate id_rsa and Public Key Certificate id_rsa.pub, which are stored in the. ssh subdirectory of the user's home directory.

2. Copy the Public Key Certificate id_rsa.pub to the. ssh subdirectory of the root directory of the Server, and change the file name to authorized_keys.
[Root @ Client root] # scp-p. ssh/id_rsa.pub root@192.168.3.206:/root /. ssh/authorized_keysroot@192.168.3.206's password: <-- enter the root user password of the Server id_rsa.pub 100% | **************************** | 218 00:00 [root @ Client root] #
When executing the preceding command, the root user of the two machines has not yet established a security trust relationship, so you also need to enter the root user password of the machine Server.

After the above two steps, the security trust relationship is established between the root of the Client and the root of the Server. Let's take a look at the effect:

[Root @ Clientroot] # scp-p text root@192.168.3.206:/root

Text 100% | ************************** | 19

[Root @ Clientroot] #

Successful! You do not need to enter the password any more.

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.