Configure ssh for public key authentication 

Joined:
04/09/2007
Posts:
753

March 16, 2009 22:10:29    Last update: March 16, 2009 22:12:35
  1. Generate the keys
    $ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/jmann/.ssh/id_rsa):
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/jmann/.ssh/id_rsa.
    Your public key has been saved in /home/jmann/.ssh/id_rsa.pub.
    The key fingerprint is:
    b8:31:e7:38:63:4c:d4:21:26:f2:ef:d0:fe:54:d3:b7 jmann@bashful
    


  2. Copy id_rsa.pub to the remote server.
    scp .ssh/id_rsa.pub jmann@sleepy:/home/jmann/.ssh/
    


  3. Logon to the remote host, append id_rsa.pub to authorized_keys. Make sure authorized_keys is writable
    only by owner.
    $ cd ~/.ssh
    $ cat id_rsa.pub >>authorized_keys
    



For putty, you need to convert the private key to putty format using puttygen:



and tell it to use the private key:

Share |
| Comment  | Tags