creating ssh keys

SSH, or secure shell, is used to access a remote terminal/machine. You can SSH into the CS lab machines from an external computer, or SSH from one lab computer to another.

By default SSH uses your CS password. For many uses (e.g., using Swat GitHub), an ssh key with a passphrase is better or possibly required.

create ssh rsa key

Here’s an example of creating an ssh rsa key:

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/dduck1/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): type stuff here...
Enter same passphrase again: type stuff here...
Your identification has been saved in id_rsa.
Your public key has been saved in
The key fingerprint is:
SHA256:wCxmJF7nA76GhKKlp7BAg6wA++/dZ5fp/QMVLekPvpE dduck1@cheese
The key's randomart image is:
+---[RSA 2048]----+
|      . ..   .  .|
|     . .  . . .o.|
|. . + o    o   ..|
|.o = O .  . .. . |
|o . * O S.   o.  |
| o + o    .  .o  |
|  o   . .o   +.. |
|   . . o.+  +.E. |
|   .o .|

using the key

Once you’ve created the key with a passphrase, you’ll generally do something with the public part (here For example, if using Swat GitHub, you’ll upload the file.

On the CS machines, if you want to use the key when SSHing from one lab machine to another, add the contents of to your ~/.ssh/authorized_keys2 file, like this:

cd ~/.ssh
cat >> authorized_keys2

Now try it out: ssh (it should ask for your passphrase instead of your password).

See also:

Back to SwatCS Help Docs