Let's review the steps to set up an SSH password-free operation:
Go to home directory
Cd
Generate Public key
ssh-keygen-t rsa-p ' (Note: The last is two single quotes, which means no password is set)
Then distribute the public key to the target machine
ssh-copy-id-i ~/.ssh/id_rsa.pub Each other machine IP (Be careful not to forget the parameter-I.)
Note: Ssh-copy-id-i is the easiest way to score two steps if you don't use this one:
A) First SCP copies the id_rsa.pub of the machine to the other machine's. SSH directory
b) Perform cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys Import Public key on the other machine
The above operation is completed, you can use the SSH machine IP to test, smooth, should not be prompted to enter the password.
If it fails, the following may be the cause:
1. Permissions issues
. SSH directory, and/home/the current user needs 700 permissions, refer to the following actions to adjust
sudo chmod ~/.ssh
sudo chmod 700/home/Current user
The Authorized_keys file in the. SSH directory requires 600 or 644 permissions, and the following actions are adjusted
sudo chmod ~/.ssh/authorized_keys
2, Strictmodes problem
Edit
sudo vi/etc/ssh/sshd_config
Found it
#StrictModes Yes
Change into
Strictmodes No
If not, you can use ssh-vvv target machine IP to view the details, according to the specific problem of the output content analysis
SSH password-free setup Failure reason summary