How to achieve SSH password-less Login
Assume that you are a user "aliceA" on hostA and want to ssh to hostB as user "aliceB", but do not want to enter the password. So, you can refer to this tutorial to achieve ssd password-less login.
First, you need to log on to hostA as the user "aliceA.
Then, use ssh-keygen to generate a pair of rsa Public and private keys. The generated key pairs are stored in ~ /. Ssh directory.
$ ssh-keygen -t rsa
Next, use the following command to create ~ /. Ssh directory. If the. ssh directory already exists on aliceB @ hostB, this step is skipped.
$ ssh aliceB@hostB mkdir -p .ssh
Finally, copy the public key of the user "aliceA" on hostA to aliceB @ hostB to implement password-less ssh.
$ cat .ssh/id_rsa.pub | ssh aliceB@hostB 'cat >> .ssh/authorized_keys'
Since then, ssh from aliceA @ hostA to aliceB @ hostB no longer requires a password. You can also run the ssh-copy-id command to create and copy a directory:ssh-copy-id -i ~/.ssh/id_rsa.pub aliceB@hostB)
Troubleshooting
Even after the key authentication takes effect, you may still need to enter the SSH password. In this case, check the system log (for example,/var/log/secure) to check whether the following exception occurs.
Authentication refused: bad ownership or modes for file/home/aliceB/. ssh/authorized_keys
In this case, the failure of key authentication is due ~ The permission or owner of the/. ssh/authorized_keys file is incorrect. Generally, this error occurs if the file is readable to all users except you. Change the file permission in the following way to correct the error.
$ chmod 700~/.ssh/authorized_keys
How to Improve the SSH login authentication speed of Ubuntu
Enable the SSH service to allow Android phones to remotely access Ubuntu 14.04
How to add dual authentication for SSH in Linux
Configure the SFTP environment for non-SSH users in Linux
Configure and manage the SSH service on Linux
Basic SSH tutorial
SSH password-free logon details
This article permanently updates the link address: