ssh-keygen
You will be prompt for a passphrase for that keypair. The keypair is
encrypted with that passphrase and saved in
~/.ssh/identity
and
~/.ssh/identity.pub
Copy the whole content of /root/.ssh/identity.pub (your public-key)
into $remote_user/.ssh/authorized_keys on the remote host.
Now you will be prompted for the passphrase of your public-key.
The easiest way to config SSH without password is giving a blank
passphrase (no passphrase use).
Now you can ssh to remote host without typing password.
For some secure reason you may use pssphrase to protect keypair.
The passphrase is normally a lot longer than a password! The advantage
you can get using the ssh-agent. It manages the passphrase during ssh
login.
ssh-agent
The ssh-agent is started now and gives you two environment-variables
$SSH_AUTH_SOCK and $SSH_AGENT_PID
With these variables the remote-sshd-daemon can connect your local
ssh-agent by using the socket-file in /tmp (in this example
/tmp/ssh-XXYqbMRe/agent.1065). The ssh-agent can now give the
passphrase to the remote host by using this socket (it is of course an
encrypted transfer)!
You just have to add your public-key to the ssh-agent with the ssh-add command.
ssh-add
Now you should be able to login using ssh to the remote host without
being prompted for a passwod!
You could add the ssh-agent and ssh-add commands in your
login-profile e.g.
eval `ssh-agent`
ssh-add
Now it is started when you login on your local workstation. You have
done it! I wish you secure logins now.
Reference: