Sunday, August 05, 2007

Password-less login with ssh

These instructions explain what to do in order to be able to use ssh for logging on a remote machine without entering your password. All our machines use ssh protocol 2, so please follow the corresponding instructions. However, for completeness, the instructions for protocol 1 are provided here as well. Please note that all instructions pertain to OpenSSH.

Protocol 2

On the originating machine, say
ssh-keygen -t rsa
Save the key in the default file (~/.ssh/id_rsa) and do not use a passphrase. This will create a file ~/.ssh/id_rsa.pub. Add the contents of this file to the file ~/.ssh/authorized_keys2 on the remote machine (i.e., the machine on which you want to log on). Whereas the id_rsa.pub file is world readable, the authorized_keys2 file should only be readable by you. Use chmod to set the permissions accordingly.

Protocol 1 (less secure, so consider this obsolete)

On the originating machine, say
ssh-keygen
Save the key in the default file (~/.ssh/identity) and do not use a passphrase. This will create a file ~/.ssh/identity.pub. Add the contents of this file to the file ~/.ssh/authorized_keys on the remote machine (i।e., the machine on which you want to log on). Whereas the identity.pub file is world readable, the authorized_key file should only be readable by you. Use chmod to set the permissions accordingly.

Source : here

No comments: