Saturday, July 3, 2021

SSH Passwordless Login Using SSH Keygen in 5 Easy Steps.

 Step 1: Create Authentication SSH-Keygen Keys on the originating machine.

$ ssh-keygen -t rsa

On Windows you could use puttygen.exe

Use a passphrase to protect keys.

On Linux private key goes to .ssh/id_rsa
Public key goes to id_rsa.pub

Step 2: Create .ssh Directory on the destination machine.

Step 3: Upload Generated Public Keys to the destination machine.

$ cat .ssh/id_rsa.pub | ssh <username>@<destination_ip> 'cat >> .ssh/authorized_keys'

<username> should be the login on the destination machine.
<destination_ip> is the public IP of the destination machine.

Step 4: Set Permissions on the destination machine.

$ ssh <username>@<destination_ip> "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"

<username> should be the login on the destination machine.
<destination_ip> is the public IP of the destination machine.

Step 5: Login from originating machine to destination machine without password.

$ ssh <username>@<destination_ip>

<username> should be the login on the destination machine.
<destination_ip> is the public IP of the destination machine.

On Windows you could use putty.exe

Taken from https://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/


No comments: