HowTo setup SSH keys
Guide on how to setup SSH keys on Linux this should work on Ubuntu, CentOS, Debian, RHEL, Fedora, Gentoo etc
Create the key pair, this will create the public and private keys:
ssh-keygen -t rsa
Accept the defaults and enter you’re passphrase when prompted, unless you do not require a passphrase (for automated backups perhaps).
Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub.
You should now have a set of keys in /root/.ssh/ now we need to copy them to the remote machine we want to login to, in this case the-death-star.techspotting.org so this would be the command:
ssh-copy-id -i ~/.ssh/id_rsa.pub root@the-death-star.techspotting.org
You will then get prompted for the password for your account on the remote host, go ahead and enter it, ssh-copy-id will then copy the key to the correct dir and sort out the correct file system permissions, cool huh?
Give it a test and make sure it’s working:
ssh the-death-star.techspotting.org
You will now be prompted for your passphrase if you entered one.