|
How to use SSH without entering your login name |
|
|
|
|
Written by Philippe Simard
|
|
Tuesday, 23 September 2008 07:28 |
No-password authentication works because of public key crypto. Let's say you have a local machine Ooga and a remote machine Booga. You want to be able to ssh from Ooga to Booga without having to enter your password. First you generate a public/private RSA key pair on Ooga. Then you send your public key to Booga, so that Booga knows that Ooga's key belongs to a list of authorized keys. Then when you try to ssh from Ooga to Booga, RSA authentication is performed automagically.
First, generate a public/private DSA key pair on Ooga.
ooga% ssh-keygen -t dsa -f ~/.ssh/id_dsa
When you are asked for a passphrase, leave it empty. Now send the public key to Booga.
ooga% cd .ssh ooga% scp id_dsa.pub user@booga:~/.ssh Next, log in to Booga and add the public key to the list of authorized keys.
ooga% ssh user@booga
booga% cd .ssh booga% cat id_dsa.pub >> authorized_keys2 booga% chmod 640 authorized_keys2 booga% rm -f id_dsa.pub
Note that the filename is authorized_keys2, not authorized_keys. That's it; you're ready to ssh from Ooga to Booga without having to enter a password.
|
|
Last Updated ( Tuesday, 23 September 2008 09:46 )
|