I am following a relatively short and simple guide on this (https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2)
Step One—Create the RSA Key Pair
ssh-keygen -t rsa
"Your public key has been saved in /Users/justinobrien/.ssh/id_rsa.pub." Okay. I renamed the public and private keys 'justin' and 'justin.pub' (as I have to do this for the root user too).
Step Three—Copy the Public Key: You can paste in the keys using ssh:
cat ~/.ssh/id_rsa.pub | ssh email@example.com "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys"
I replaced the ip with my ip, the name of my files and the name of my user('justin') so:
cat ~/.ssh/justin.pub | ssh firstname.lastname@example.org..***"mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys"
"You may see something like:"
The authenticity of host '198.51.100.0 (198.51.100.0)' can't be established. RSA key fingerprint is b1:2d:33:67:ce:35:4d:5f:f3:a8:cd:c0:c4:48:86:12. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '198.51.100.0' (RSA) to the list of known hosts. email@example.com's password:
But this is not what I see, I enter the command above and only get asked to login with my password? I.e. all I see is:
Update, in the comments below I found I may have already set this up and just need to restart the server: I ran
sudo reboot. Now I can attempt to connect again as either 'root' or 'justin' 3 times, before being asked for the password :
ssh firstname.lastname@example.org..*** ssh: connect to host 142.93..*** port 22: Operation timed out ssh email@example.com..*** ssh: connect to host 142.93..*** port 22: Connection refused ssh firstname.lastname@example.org..*** ssh: connect to host 142.93..*** port 22: Connection refused
If I try again a 4th time, it will ask for my password and allow me to connect. Not really sure what is going on here. I ran
sudo ufw allow 22 to no avail. Thanks for any help.