Popular Posts

Monday, May 12, 2014

How to setup passwordless ssh - linux

Tired of typing passwords every time ? then you might want to check below method :)
In this tutorial I will guide you regarding how to setup passwordless ssh (key based ssh) between two linux hosts.

I have 2 VMs and I would like to setup key based ssh from ansible-ground (first VM) to qabox (second VM) as root user.

Steps :

1. Generate ssh key pair on host A i.e. ansible-ground in my case.

ssh-keygen -t rsa

2. Copy public key generated in above step to host B i.e. qabox in my case.

ssh-copy-id -i ~/.ssh/id_rsa.pub root@qabox

Note : root is the username for which you need password less ssh and qabox is host B

3. On host B - set the correct permissions for copied public key.

chmod 0600 ~/.ssh/authorized_keys

4. We are done!  now try to login from A-->B with root user.

Please let me know in case of issues.