SSH keys

From NYU CCPP Wiki

To avoid typing your password all the time, you can authenticate with "SSH keys". This is safer than using your password, because passwords are often cracked by monitoring keystrokes.

Setting up SSH keys

Use the following command to generate a key:

ssh-keygen -t dsa

When ssh-keygen asks for a passphrase, DO NOT just press return; instead, enter a passphrase. Then make this key an "authorized key" as follows:

cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

Test that everything works with:

ssh bias

that it logs you into bias without asking for a password, and instead asking for a passphrase.

Avoiding passphrase typing with SSH agents

Make your passphrase something good, and then use

eval `ssh-agent`
ssh-add

to set up an "agent" in your shell that authenticates for you. Then whatever child processes or ssh's you do from that shell will have access to machines that recognize the public keys you have added. This is secure.