Passwordless ssh
Saturday, February 25th, 2006How does the passwordless ssh login work? Simple. The user sends his public key along when attempting to connect. If the key is found in the .ssh/authorized_keys on the server, the server sends a random number encrypted with the public key to the client. The client being in the possesion of the private key is able to decrypt the message and answer and is therefore authenticated.
The two lines solution for ssh-ing without password is:
(1) ssh-keygen -t rsa #generate the rsa keys, if you did not do this before
(2) cat .ssh/id_rsa.pub | ssh ‘cat >> ~/.ssh/authorized_keys’ # append the public key to the authorized keys on the server
Note that the solution could be a one liner if you already have the rsa keys generated before (e.g. you are setting up the passwordless login for a second server)