SSH password less key authentication 101

Check whether you already have a key pair generated. Inside .ssh directory of your home, if you see files name id_rsa and id_rsa.pub then you can use them.

If you don’t have them, generate a new one.

How to generate a SSH key pair?

ssh-keygen -t rsa

To be able to use password less authentication, you need to put the public key on server.

Do that either by adding the contents of public key file in ~/.ssh/authorized_keys on server or use ssh-copy-id user@serverhost which will do that for you.

Now just attempt to login by user@serverhost.com and you will be able to do so.

Its totally safe to use public key because without your private key that’s no good to anyone.

How it works?

Server sends you a challenge string which you encrypt using your private key and send the encrypted challenge string back. Now only your public key can decrypt it to what it originally was, thus confirming its actually you and let you login. Simple enough.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *