Linux Remote file synchronization

Source: Internet
Author: User

1. Prepare the Environment first

sudo apt-get install SSH
2. Create a voucher
ssh-keygen//Note that both file and passphrase do not need to input generating public/private RSA key pair. Enter file in which to save the key (/HOME/USER1/.SSH/ID_RSA):/home/User1/.ssh/id_rsa already exists. Overwrite (y/n)?  [email protected]:~$ ssh-keygengenerating public/private RSA key pair. Enter file in which to save the key (/HOME/USER1/.SSH/ID_RSA):  /home/user1/.ssh/id_rsa already exists. Overwrite (y/n)? Yenter passphrase (empty for no passphrase):  enter same passphrase Again: your identification have been saved in /home/user1/.ssh/id_rsa. Your public key have been saved in/home/user1/.ssh/ key fingerprint is:ed:89:09:e0:5b:44:d0:78:e3:a2:a2:55 : 5c:15:43:e2 [email protected]the key ' s randomart image is:+--[RSA 2048]----+|    .+oo=.       | |    .o=. .       | |  .. +e.         | |  . +o.  .       | |   O.. o S.      | |. o  o. + .     | |. o  .   o o      | |.                | |                 |+-----------------+ 

3. Upload the voucher

SCP ~/.ssh/ [Email Protected]:/home/user1/.ssh/authorized_keys If the remote report does not have this directory exception, you can first execute the ssh-keygen command on the remote machine, Copy success information: 100% 0.4kb/s 00:00

4. No password connection

Ssh-add ~/.ssh/id_rsa//Connection Success Information, note that the command prompt has been switched to the remote: Last Login:sat Oct-09:57:29 from[[email protected] ~]$

Set its file permissions chmod ~/.ssh/authorized_keys

5. File synchronization

Rsync-a--delete/opt/data/[Email protected]:/opt/data/

Linux Remote file synchronization

Related Article

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: 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.