Setting up SSH Keys

We recommend using ssh keys if you want to login to another account (such as a class account) via SSH.

To generate the ssh key for your CSIL account, open a Linux command line (either Terminal or SSH onto your account), use the "ssh-keygen" command:

$ ssh-keygen -t rsa 

You will be prompted with a few questions - usually the defaults will be fine.

Creating a passphrase is one of the questions you will be prompted with during key creation.

If you need to add a passphrase to an existing key, use the following command:

 $ ssh-keygen -p

You will be prompted for the name of the file in which the key is.

Unless you have multiple keys, the default should be fine.

Enter a passphrase that is easy to remember but hard to figure out

Be sure to use something you can remember, because if you forget the passphrase, the key is useless. 

Next, copy the contents of ~/.ssh/id_rsa.pub to the file ~/.ssh/authorized_keys

An easy way to copy the contents of your pub file is to use the following command:

 $ cat *.pub >> authorized_keys

Now, when you ssh between COE machines, your ssh key will be used, instead of password authentication.


Note

Please be aware that you want your keys to be as secure as possible. Some operating systems create files with world read permissions that have to be removed before use

example commands to set world permissions to "0" no read, write, or execute permissions.

 $ chmod 650 authorized_keys
 $ chmod 600 id_rsa


Note

If you are a TA who needs access to a class account via SSH keys, please see SSH Access to CS Class accounts for Teaching Assistants