Wednesday, May 14, 2008

How to Set up Password-less SSH'ing?

Create RSA key pairs:
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/joe/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/joe/.ssh/id_rsa.
Your public key has been saved in /home/joe/.ssh/id_rsa.pub.
The key fingerprint is:
00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 joe@mycomputer
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
+-----------------+
Copy your public key to host server:
$ scp ~/.ssh/id_rsa.pub joe@example.com:~/.ssh/joe@mycomputer.pub
Then, log into your host server and create/append the public key to a file named, authorized_keys:
$ cat ~/.ssh/joe@mycomputer.pub >> ~/.ssh/authorized_keys
$ chmod go-w ~/. ~/.ssh/authorized_keys
$ chmod go-rwx ~/.ssh
http://www.openssh.org/faq.html#3.14
NOW, logout and log back in. You won't be asked for the password again!

No comments:

Post a Comment