In order to prevent data loss, what we often do is to back up these data on the computer, but although it is safe to back up the data, what should I do if the computer where the data is located? By backing up the data on this machine, once the hard disk of the machine fails, the data cannot be taken out. Remote manual backup of data is time consuming and time consuming. The best way is to implement remote automatic mutual preparation through scripts. However, whether you log in via SSH or copy files through scp, you need to enter a password. In order to overcome this problem, you first need to implement SSH login without password, so you can use rsync, scp, rexec and other commands to do remote backup.
1. Set up ssh login without password, the method is as follows:
Suppose A and B servers, now need to log in to the B machine on the A machine without entering the password, then we You can do the following steps:
1) To generate a key pair on the A machine, execute the following command:
ssh-keygen -t rsa
Generating public/private rsa Key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa
Enter passphrase (empty for no passphrase): direct Enter
Enter same passphrase again: Direct return
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /Root/.ssh/id_rsa.pub.
The key fingerprint is:
f6:61:a8:27:35:cf:4c:6d:13:22:70:cf: 4c:c8:a0:23 root@host1
Thus, id_rsa, and id_rsa.pub are generated in the /root/.ssh/path, where id_rsa is the key and id_rsa.pub is the public key.
2) Copy the id_rsa.pub generated on the A machine to the B machine, assuming copying to the temporary directory of the B machine, such as:
scp /root/.ssh/id_rsa.pub [email protected]:/tmp
3) Log in to the B machine with the root account, enter its home directory, create the authorized_keys file, and set the permissions.
cd ~/.ssh
cat /tmp/id_rsa.pub >>authorized_keys
chmod 400 authorized_keys
rm -f /tmp/Id_rsa.pub
4) Test
Go to the root account on the A machine and try to log in to the B machine. See if you don't want a password.
Description:
The permissions of the authorized_keys file are important. If you set it to 777, you still need to provide a password when you log in.
Remember to delete the id_rsa.pub in the temporary directory to develop a good habit.
This method was tested on Red Hat 9.0.
Nowadays, no matter whether it is work or life, it is inseparable from the Internet. Many people cla
Many users have installed dual systems on their computers to meet their work and life needs. However
I believe that everyone has encountered it. When installing Thunder, I accidentally installed the Th
1: Open the control panel, and then find the uninstall or change the program, in fact not. To click
Users can experience Chrome OS
Unity users use WinXP again over Win7 system
How to view the hidden partition of the u disk?
How does Win8 set performance priority?
Damage to the computer's "tool" - dust
How to add a watermark to a Word document?
How to prohibit others from accessing the computer C drive?
Teach you how to detect ARP virus in your computer
WinME does not automatically shut down
How to cancel the sharing function of Baidu network disk?
Analyze the cause of the sudden failure of the right mouse button and the solution
CF and QT voice recruitment elite to send Hao Li
Master teaches you how to start four channels in win7
Cheetah browser mobile version download movie video method
Win8 system virtual memory to expand storage space how to set
My world survival mode how to mine the most efficient
Where is the path of the Win10 system with the magnifying glass tool
Win7 system notebook sharing wireless network graphic tutorial
How to create local users under Win10 system
WinXP how to open the speech recognition system for speech recognition based on accent