SCP replicates between Linux hosts without entering a password

Source: Internet
Author: User
Tags scp file scp command

Copy your local host user's SSH public key file to the remote host user's ~/.ssh/authorized_keys file, assuming the local host Linux (10.1.1.1), remote host Linux (10.1.1.2)

One, the user in the LINUX100 host

Run

#ssh-keygen-t RSA

The results are as follows

Generating public/private RSA key pair.

Enter file in which to save the key (/HOME/.USERNAME/SSH/ID_RSA): #回车

Enter passphrase (empty for no passphrase): #回车

Enter same passphrase again: #回车

Your identification has been saved In/home/.username/.ssh/id_rsa.

Your public key has been saved In/home/.username/.ssh/id_rsa.pub.

The key fingerprint is:

38:25:c1:4d:5d:d3:89:bb:46:67:bf:52:af:c3:17:0c [email protected]

Generating RSA keys:

Key generation complete.

Will generate two files in the user directory ~/.ssh/, id_rsa,id_rsa.pub

Second, copy the Id_rsa.pub file on the Linux (10.1.1.1) host to the. SSH directory under the root user directory of the Linux (10.1.1.2) host and rename it to Authorized_keys

That

/root/.ssh/authorized_keys

This allows the use of the SCP command on the linux100 host to copy files to Linux (10.1.1.2) will not prompt for a password, directly copied. Vice versa!

Third, copy the file or directory command:

To copy a file:

(1) Copy Local files to remote

SCP file name [email protected]: remote path

(2) Copy files back to local from remote

SCP [email protected]: File name Local path

To copy a directory:

(1) Copy the local directory to the remote

Scp-r directory name [email protected]: remote path

(2) Copy the directory back to local from remote

Scp-r [email protected]: Directory name local path.

SCP replicates between Linux hosts without entering a password

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.