SSH Passwordless Login Using SSH Keygen
Notice: Do not enter a passphrase.
~/.ssh$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/userA/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/userA/.ssh/id_rsa
Your public key has been saved in /home/userA/.ssh/id_rsa.pub
The key fingerprint is:
The key’s randomart image is:
|..+.=+= ++o . +|
|.= = + + …+ =E+|
|* * + + .+ =.Bo|
|.* . + . o . =..|
| o = S . |
| = . |
| . . |
| . |
Create a directory ~/.ssh (if it does not exist 🙂 ):
~/.ssh$ ssh userB@machineB mkdir -p .ssh
The authenticity of host ‘machineB (111.222.333.444)’ can’t be established.
RSA key fingerprint is SHA256:yngrwOAobBhLaPxgo0ORHWwKQXJW2ItyTXuuBcpA15w.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added ‘machineB,111.222.333.444’ (RSA) to the list of known hosts.
Copy a public key to userB@machineB:.ssh/authorized_keys:
~/.ssh$ cat id_rsa.pub | ssh userB@machineB ‘cat >> .ssh/authorized_keys’
You can try it
~/.ssh$ ssh userB@machineB