Login. Set SSH login without a password. The method is as follows:
Assume that the server a and server B needs to log on to server B with root instead of entering the password on server a. follow these steps:
1) generate a key pair on machine A and 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): Press ENTER
Enter same passphrase again: Press ENTER
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
In this way, id_rsa and id_rsa.pub are generated under the/root/. Ssh/path, where id_rsa is the key and id_rsa.pub is the public key.
2) Copy id_rsa.pub generated on machine A to machine B. Assume that it is copied to the temporary directory of machine B, for example:
SCP/root/. Ssh/id_rsa.pub root@218.242.214.20:/tmp
3) log on to machine B with the root account, go to 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 machine A and try to log on to machine B. Check if the password is not required.
Note:
The authorized_keys File Permission is very important. If it is set to 777, you still need to provide a password when logging on.
Remember to delete id_rsa.pub in the temporary directory.