This is a note for myself, hope that would be helpful for someone else.
Summary:
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
tP9FA5YMpqa6umEKAtJSIVgwZGBWvpkGElqvpP5r720f3XScpHkL/t/AnCPVeDn2jtL4XBkMDacOViD8m9P/TtQXthDqR3ZTtixsAXACm/bjLJKtUJUqrzTbM5LfQe7hh1xq8EyCXF6shvuXS/
0GUvyjPhGPkhFGIjFrPwbWnw8qudzBIlbGEMhboVwDeqJohDd7nkd2Ww0VyBMplJwEs2VGdI/HNwHKXp2HNgbJBCkWvNe7Aq3YekV/aqgd7QPjasZf8OM1hAVjWoVw== [email protected]
4 - Copy the public key to Cloud using ssh-copy-id:
# ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
The authenticity of host '
192.168.1.123
(192.168.1.123)' 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 '192.168.1.123' (RSA) to the list of known hosts.
[email protected]'s password:
Now try logging into the machine, with "ssh '[email protected]'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
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 [email protected]
Last login: Wed Dec 18 13:00:57 2013 from 219.91.219.14
[root@s15405085 ~]#
Hope you find it helpful, if you have any question, comment below
Happy Coding!