Setup SSH public key authentication

28 Jan 2007

Setup SSH public key authentication in three steps

1. generate public key at the localhost
# martijn@serudaru:~$ ssh-keygen -t rsa
# Generating public/private rsa key pair.
# Enter file in which to save the key (/home/martijn/.ssh/id_rsa):
# Enter passphrase (empty for no passphrase):

2. copy out the public key to the remote server
# martijn@serudaru:~$ scp ~/.ssh/id_rsa.pub user@host:.ssh/authorized_keys2
# The authenticity of host 'host (194.x.x.x)' can't be established.
# DSA key fingerprint is c0:--:--:--:--:--:--:--:--:--:--:--:--:--:--:--.
# Are you sure you want to continue connecting (yes/no)? yes
# Warning: Permanently added 'host (194.x.x.x)' (DSA) to the list of known hosts.
# Password:
#id_rsa.pub ============================ 100% 398 0.4KB/s 00:00

3. ssh into the remote server
# martijn@serudaru:~$ ssh user@host

Note that the first step (Enter passphrase (empty for no passphrase)) does not explicit requires a passphrase. You'll be able to connect over SSH without entering any passwords.
The only security youll use the is user@host combination from the source host.

blog comments powered by Disqus