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 an SSH key pair?

ssh-keygen -t rsa

To be able to use passwordless 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 the server or use ssh-copy-id user@serverhost which will do that for you.

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

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

How does it work?

The 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 log in. Simple enough.

Facebook Comments

Show More

Leave a Reply

Back to top button