password-less ssh login

Standard

When you have to regularly ssh from one machine to another, for my job this is a mundane everyday task, you’ll learn to hate it that everytime you have to type in the username and password combination to authenticate yourself. If the machine is a workstation machine and only you have access to it, then there’s no reason why it shouldn’t be password-less and make ssh-ing a painless task.

This can be done easily by creating a trusted public key by using

This will make a directory called .ssh in your home directory if you do not have one, give it the right permission and run the ssh-keygen command to generate the relevant keys. You might want to give your ssh key a password during the process, but I suggest not. This is a password-less procedure anyway. Your keys will be stored as ~/.ssh/id_rsa.pub.

Let’s stay you are ssh-ing from <local_machine> to <server>. What you want to do next is to copy the file over to the server. On some machine you could just do

And it’s done. Or if your OS does not support ssh-copy-id, you simply should just run

and type if your server password for the very last time.

Next time you ssh over to the <server> machine from the <local_machine>, the handshake will commence and no password will be needed. Moreover, if you ssh from another machine, then password will still be required to retain security. Have fun!

Leave a Reply