Configure ssh for public key authentication
March 16, 2009 22:10:29 Last update: March 16, 2009 22:12:35
- 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
- Copy
id_rsa.pubto the remote server.scp .ssh/id_rsa.pub jmann@sleepy:/home/jmann/.ssh/
- Logon to the remote host, append
id_rsa.pubtoauthorized_keys. Make sureauthorized_keysis 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:
