create public and private keys. You can just hit enter or change the options.

 ssh-keygen -t rsa 

Now we need to copy our public key to the servers authorized keys

 cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys" 

Now once you’ve completed teh above you should just be able to ssh to the remote host.

If you want to be able to ssh as root. As long as the without-password option in /etc/ssh/sshd_config you should be able to do the below

 sudo su 




 cat /home/user/.ssh/authorized_keys >> /root/.ssh/authorized_keys 

Now you should be able to ssh as root to the server now.