Linux Passwordless SSH

From Nonecks Docs

Jump to: navigation, search

SSH with No Password

  1. Create SSH Key
username@server:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.
The key fingerprint is:
21:67:13:73:23:XX:XX:78:78:XX:14:fc:d5:50:4c:ef username@im
The key's randomart image is:
+--[ RSA 2048]----+
|       .+o+=o++=.|
|        .++oo.=.o|
|        . oo ..o.|
|       o oo   E .|
|      . S        |
|                 |
|                 |
|                 |
|                 |
+-----------------+
  1. Now copy Key to server of choice
username@im:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub username@forums
username@forums's password:
Now try logging into the machine, with "ssh 'rrussell@forums'", and check in:
 .ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
  1. Now log on to new server to test!
username@im:~$ ssh username@forums
Enter passphrase for key '/home/username/.ssh/id_rsa':
Enter passphrase for key '/home/username/.ssh/id_rsa':
Linux forums 2.6.26-1-amd64 #1 SMP Fri Mar 13 17:46:45 UTC 2009 x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright. 
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
Last login: Wed Jul  1 08:56:25 2009 from im.auctiva.com
username@forums:~$ exit