All on the host you are ssh
ing from.
- Create key. Press ENTER at every prompt.
ssh-keygen
- Copy key to remote host.
ssh-copy-id -psome_port user@host
Edit /etc/ssh/sshd_config
PermitRootLogin
if needed.
details: http://linuxconfig.org/passwordless-ssh
and http://askubuntu.com/questions/224190/how-can-i-make-ssh-copy-id-use-a-port-other-than-22