Passwordless SSH

Whenever you log into your SSH account on some host (e.g. your webhosting provider) you'll be prompted for your password. Although this is of course important for the security of your account, it might be annoying at some point. Fortunately, there is a way to automate the authorization by providing your local computer with a private key. To do this create locally (i.e. on the client) a pair of keys consisting of a private and a public key. As the name implies the public key doesn't need to be kept secure. It's the one we will transfer to the server. But make sure that the private key is kept secret and is not available for anyone else, as this would have the same effect as telling the password to your account.

ssh-keygen -t rsa

Transfer the public part of this key to the server.

ssh-copy-id -i ~/.ssh/id_rsa.pub username@server

You should now be able to log into your server without typing a password. More details and a further discussion on more secure variants can be found e.g. at http://www.debian-administration.org/articles/152.

OpenSSH and SSH

The above implies that both the workstation and the server are using OpenSSH. However, you can still setup passwordless logins when e.g. the server uses SSH. You can find out which versions are in use by issuing

ssh -V
ssh: SSH Secure Shell 3.2.9.1 (non-commercial version) on i686-pc-linux-gnu

In this case we get to know that the machine does not use OpenSSH but SSH instead.
First we have to convert our public key id_rsa.pub so that it will be readable for SSH as well. This is done by

ssh-keygen -f id_rsa.pub -e >> id_rsa_openssh.pub

Now, we transfer this key to the server and configure the server so it will use it.

scp id_rsa_openssh.pub username@server:~/.ssh2
ssh username@server 'echo "Key id_rsa_openssh.pub" >> .ssh2/authorization' 

This and more details for trouble shooting can be found at http://www.hlrn.de/doc_colony/ssh/index.html.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.