ssh pubkey - weakish/cheat GitHub Wiki

Generate public key

ssh-keygen -t dsa

Add your key to host

you@local: scp ~/.ssh/id_dsa.pub remote:
you@remote: mkdir ~/.ssh
you@remote: chmod 700 ~/.ssh
you@remote: cat ~/id_dsa.pub >> ~/.ssh/authorized_keys2
you@remote: chmod 600 ~/.ssh/authorized_keys2

Configure alias

Edit ~/.ssh/config. Example:

Host foo
    HostName foo.example.com
    Port 22
    User you
    Compression yes

End note

For security, you should set up a passphrase for your public key. For convenience in automation tasks, use a public key without a passphrase.

DSA use a fixed 1024 key size while RSA allows variable (say, 2048) key size. So you may use RSA instead.