Friday, June 5, 2009

Passwordless ssh login

1 Generate keys

Type:

   ssh-keygen -t rsa

And do not enter a passphrase unless you wanted to be prompted for one during file copying.

Here is what you will see:

   $ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/User/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/User/.ssh/id_rsa.
Your public key has been saved in /home/User/.ssh/id_rsa.pub.
The key fingerprint is:
5a:cd:2b:0a:cd:d9:15:85:26:79:40:0c:55:2a:f4:23 User@JEFF-CPU
2 Copy public to machines you want to upload to

id_rsa.pub is your public key. Copy it to ~/.ssh on target machine.

Put a copy of the public key file on each machine you want to log into. Name the copy authorized_keys (some implementations name this file authorized_keys2)

Then type:

     chmod 600 authorized_keys

Then make sure your home dir on the remote machine is not group or world writeable.

No comments: