I previously followed this guide to add SSH keys to my remote server(I didn't hide or remove the keys from anywhere, just to be sure I don't lose access). It was passphrase protected. However I changed the passphrase to something else, and changed it back to the old one but now I can't login to it using another terminal session. Only my current terminal session is logged on, and unfortunately this is all as the root user. I generated new SSH key and added it to the server as well as my machine too but I still can't logon on it from another terminal session. How can I fix this?!
I fear I'd get locked out if I can't find a solution in time, that is, if my internet disconnects..
Best Answer
Check the logs on the server. If a login is failed, usually something is written to the logs.
According to your comment, you can't su with an ordinary user. This suggests you trying to supply a wrong password, otherwise su would work.
Try changing the root password to something simple which cannot possibly be mistyped. If the server isn't behid a firewall, just be sure to change to something long, that will do for the short time you're experimenting. Be sure to actually type the password, do not copy and paste it.
If you have public/private keys, be sure that only the owner has read/write access the
.ssh
directory, as well as to the keys. The ssh server won't authorize a key which is accessible to anyone but the owner.If you still can't login, run the ssh server in debug mode on an other port like this:
Then try connecting to the port 10022. The debug sshd process will log everything to the screen, so you may be able to spot any errors or anomalies preventing you from logging in.