- A Programmer's Life

Setup SSH Passwordless Login In Linux

For login to remote server without password you need to generate the ssh key.

This is a note for myself, hope that would be helpful for someone else.


You want to connect from your local ( Local  ) to your cloud ( Cloud )

Below are steps to setup login for SSH without enter password:

1 - Generate SSH Private/Public key:

Use the below command to generate the RSA ssh key on your local

# ssh-keygen -t rsa

2 - View generated SSH Private/Public key:

The private/public key has been generated and stored at “/root/.ssh/”. Go to the corresponding directory and see the generated keys. See the output.

# cd /root/.ssh/
[root@2daygeek .ssh]# ll -h
total 12K
-rw------- 1 root root 1.7K Dec 18 13:01 id_rsa
-rw-r--r-- 1 root root 419 Dec 18 13:01 id_rsa.pub
-rw-r--r-- 1 root root 1.6K Aug 23 08:15 known_hosts

3 - The id_rsa.pub key is below:

Use the below command to view the id_rsa.pub details

# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0JOae6XhB1NccSrms4NpuLufOiMu10ObKoxWHtQ5oVXUvCuFz7Vxp5eKIGmizLtZoFxi3DOKcuV
0GUvyjPhGPkhFGIjFrPwbWnw8qudzBIlbGEMhboVwDeqJohDd7nkd2Ww0VyBMplJwEs2VGdI/HNwHKXp2HNgbJBCkWvNe7Aq3YekV/aqgd7QPjasZf8OM1hAVjWoVw== root@local.chilieu.me

4 -  Copy the public key to Cloud using ssh-copy-id:

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

The authenticity of host '

(' can't be established.
RSA key fingerprint is 6f:ad:07:15:65:bf:54:a6:8c:5f:c4:3b:99:e5:2d:34.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
root@'s password:
Now try logging into the machine, with "ssh 'root@'", and check in:


to make sure we haven't added extra keys that you weren't expecting.

Note :

The ssh-copy-id copy the id_rsa.pub key to remote server with name of authorized_key under “/root/.ssh/”.

5 -  Try access Cloud server without Password 

Now, you can access the remote host without entering password. like below

# ssh root@
Last login: Wed Dec 18 13:00:57 2013 from
[root@s15405085 ~]#

Hope you find it helpful, if you have any question, comment below

Happy Coding!