You are on page 1of 1

Setting up ssh keys

Getting Started

1. On each machine type ssh somemachine.example.com and make a connection with


your regular password. This will create a .ssh dir in your home directory with the proper
perms.
2. On your primary machine where you want your secret keys to live, type

ssh-keygen -t dsa
This will prompt you for a secret passphrase. If this is your primary identity key,
make sure to use a good passphrase. If this works right you will get two files
called id_dsa and id_dsa.pub in your .ssh dir. Note: it is possible to just press
the enter key when prompted for a passphrase, which will make a key with no
passphrase. This is a Bad Idea ™ for an identity key, so don't do it! See below
for uses of keys without passphrases.
3. scp ~/.ssh/id_dsa.pub burly:.ssh/authorized_keys2
Copy the id_dsa.pub file to the other host's .ssh dir with the name
authorized_keys2.

4. ssh-add command will tell which keys to use it. For a test, type

ssh-agent sh -c 'ssh-add < /dev/null && bash'


This will start the ssh-agent, add your default identity(prompting you for your
passphrase), and spawn a bash shell. From this new shell you should be able to:
5. ssh <<System-name>>
This should let you in without typing a password or passphrase. Now you can ssh
and scp all you want from this bash shell and not have to type any password or
passphrase.

You might also like