Methods for synchronizing files without requiring a password to execute rsync via SSH _ server other

Source: Internet
Author: User
Tags ssh rsync ssh account

1. Perform rsync via SSH (password required)

Perform rsync through an SSH account (requiring a password) to mirror files synchronously to a remote server.
The following example synchronizes the local/home/ramesh to the remote directory/backup/ramesh (server address 192.168.200.10).
When you do the following, the server prompts the user to log in with a password.

Copy Code code as follows:

Rsync-avz-e ssh/home/ramesh/ramesh@192.168.200.10:/backup/ramesh/

2. Use Ssh-keygen to generate keys

Now let's set up SSH so that you do not need a password to perform an SSH operation, and use Ssh-keygen to generate the public and private key locally.

Copy Code code as follows:

$ ssh-keygen
Enter passphrase (empty for no passphrase):
Enter same Passphrase again:

Tip: When prompted to enter a password, just enter the Enter two times, do not refer to the password character.

3. Copy the public key to the remote host using Ssh-copy-id

Executes the ssh-copy-id and copies the public key generated by Ssh-keygen to the remote host.

Copy Code code as follows:

Ssh-copy-id-i ~/.ssh/id_rsa.pub 192.168.200.10

Tip: When you do this, you will be prompted to enter the remote host account and password, and the public key will be automatically copied to the remote directory.

4. Do not need password through SSH to perform rsync

Now, you can ssh to a remote host without needing a password

Copy Code code as follows:

SSH 192.168.200.10

To perform rsync again, you should not be prompted to enter the password now.

Copy Code code as follows:

Rsync-avz-e ssh/home/ramesh/ramesh@192.168.200.10:/backup/ramesh/

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.