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/hpotter1/.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 id_rsa.pub.
The key fingerprint is:
SHA256:wCxmJF7nA76GhKKlp7BAg6wA++/dZ5fp/QMVLekPvpE hpotter1@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 . =.o+..ooo|
+----[SHA256]-----+

using the key

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

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

cd ~/.ssh
cat id_rsa.pub >> authorized_keys2

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

See also:


Back to SwatCS Help Docs