Table of Contents

Set Up SSH Keys

Common Use

Use this command to set up your SSH key on a remote server that you log into frequently:

ssh-copy-id user@remote.host.name

Without ssh-copy-id

If the ssh-copy-id script is not available:

cat ~/.ssh/*.pub | ssh user@remote.host.name 'umask 077; cat >>.ssh/authorized_keys'

Non-Standard SSH Port

If SSH is on a non-standard port:

ssh-copy-id -p 2222 user@remote.host.name

or:

cat ~/.ssh/*.pub | ssh -p 2222 root@remote.host.name 'umask 077; cat >>.ssh/authorized_keys'

Generate Public Key

If no public key yet exists on the machine you will be using to make remote connections, you'll need to create one. This is only done once:

ssh-keygen -t rsa

You probably want to just hit enter at the passphrase prompt.