SSH Passwordless Login Using SSH Keygen

SSH Passwordless Login Using SSH Keygen

SSH Client : 192.168.0.12
SSH Remote Host : 192.168.0.11

Step 1: Create Authentication SSH-Kegen Keys on – (192.168.0.12)

# ssh-keygen -t rsa

Step 2: Create .ssh Directory on – 192.168.0.11

Use SSH from server 192.168.0.12 to connect server 192.168.0.11 using sheena as user and create .ssh directory under it, using following command.

# ssh sheena@192.168.0.11 mkdir -p .ssh

Step 3: Upload Generated Public Keys to – 192.168.0.11

Use SSH from server 192.168.0.12 and upload new generated public key (id_rsa.pub) on server 192.168.0.11under sheena‘s .ssh directory as a file name authorized_keys.

# cat .ssh/id_rsa.pub | ssh sheena@192.168.0.11 ‘cat >> .ssh/authorized_keys’

Step 4: Set Permissions on – 192.168.0.11

Due to different SSH versions on servers, we need to set permissions on .ssh directory and authorized_keys file

# ssh sheena@192.168.0.11 “chmod 700 .ssh; chmod 640 .ssh/authorized_keys”

Step 5: Login from 192.168.0.12 to 192.168.0.11 Server without Password

From now onwards you can log into 192.168.0.11 as sheena user from server 192.168.0.12 as tecmint user without password.

# ssh sheena@192.168.0.11

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *