Passwordless connection to a remote server can be done in TWO steps :
STEP #1 : Setup the Public key and send it to the server that is to be connected
i) cd ~/.ssh : ssh contains all the private and public keysii) ssh -keygen -t rsa [ do not enter password when asked ] : This will create two keys (a) private key (b)public key (.pub extension)
iii) scp ~/.ssh/id_rsa.pub [user]@[server]:~/ : This step will copy the public key to the target server
STEP #2 : Changing the permission of the copied key and storing it in authorized_keys folder
i) open a terminal on [target server] and mkdir ~/.sshii) chmod 700 ~/.ssh
iii) touch ~/.ssh/authorized_keys
iv) cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
v) chmod 600 ~/.ssh/authorized_keys
vi) rm ~/id_rsa.pub