Skip to content

Login to SSH with Keys instead of Password

Posted in Server

Everyone knows the power of SSH. SSH’s usefulness blows major security issues out of the water, when you authenticate with your server from your local computer using public key authentication.

I mess up a lot with PC, and one day, whatever the reasons were, I couldn’t seamlessly log into my server, and had to enter password. I don’t hate passwords, but just typing them in all the time is boring. I’ve been enduring this nightmare for a while, but went reading what the problem is. Figured the solution is simple:

First: Reset your server pairing information on your local PC:

Then: Generate new ssh id_rsa on your local PC:

Next: Copy generated key to server which will be used for authentication. I used ssh-copy-id for the first time, and the experience was amazing:

Now, ssh into your IP address again, and it shouldn’t ask you for password to your user account.

NOTE: DO NOT ALLOW login to your Sever via root!