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/id_rsa.pub.the 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/id_rsa.pub [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: Id_rsa.pub 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 192.16.1.100[[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