1)#ssh-keygen -t rsa
-t rsa it will create the RSA(Rivest, Shamir and Adleman) Key
it will creat the key with file name "id_rsa.pub" under the current user Home Directory.
If it is root mean /root/.ssh/id_rsa.pub
if it is redhat mean /home/redhat/.ssh/id_rsa.pub
ssh-copy-id it will install public key to the remote machine
then copy the id to the remote system, For first time it will ask the password.
Next it will not ask the password.
#ssy-copy-id -i /root/.ssh/id_rsa.pub remoteuser@remoteip
2)#ssh-copy-id -i /root/.ssh/id_rsa.pub firstname.lastname@example.org
While Copy the key it will ask the Password For enter the Login credentials.
AFter copy completed.
3)then try to login from the remote sytem. It doesn't ask any of the password.
Even though SSH HOST offer RSA public Key if it is ask password
we should maintain $HOME/.ssh folder with 700 permission
NOTE: if .ssh folder has full permission even though it supply rsa public key, it will ask the password like following,
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Offering public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: password
to avoid these we've to maintain right permission #chmod -R 700 .ssh
$HOME/.ssh/id_rsa - it should able to access only by the user.