CS 212 Software Development

CS 212-02 • Spring 2020

Configuring SSH Keys

You will be accessing your Github repositories and CS lab computers for this course frequently. It will save you a lot of time to setup your SSH keys to avoid having to enter a username and password each time.

 SSH "passwordless login" uses public key authentication instead of passwords.

Video Walkthrough

This video walkthrough will illustrate this entire process on a Mac OSX system. Alternatively, you can follow the steps in the sections below.


https://youtu.be/PO66ooR9n1g

Authorize CS Labs on GitHub

You should first authorize our CS lab computers to access your Github repositories.

  1. Log into one of the CS lab computers using your CS account. See the "Using CS Lab Computers" guide for help if you are unsure how to do this step.

  2. Follow the Github Generating a New SSH Key guide for Linux. Before you start:

    • When prompted for a passphrase for your key, you can press Enter without entering anything. It is more secure to enter a passphrase, but less convenient. See the Working with SSH Key Passphrases guide from Github for more information.

    • Do NOT forget to complete the Add the SSH Key to Github step at the very end!

  3. Follow the Github Testing Your SSH Connection guide from a CS lab computer to make sure everything is setup properly.

At this point, you should be able to run the homework and project scripts from the CS lab computers.

Authorize Your System on GitHub

I recommend you follow the same process above on your own local laptop or computer system. The GitHub guides linked above have steps for Mac, Windows, and Linux systems.

Once you complete this process, you should be able to clone, pull, and push your Github repositories in Eclipse.

Authorize Your System on CS Labs

In a Terminal window on your system (Mac or Linux), change to the directory with your SSH keys. Make sure your public key is listed there. You should be able to use these commands:

Next, you need to let stargate.cs.usfca.edu know your public key is authorized. You do this by copying the contents of your public key to the authorized_keys file in the .ssh directory. You should be able to use these commands to do this in one step:

Replace username with your CS username and keyname with the name of your public key before copy/paste. This is usually id_rsa.pub but the exact name depends on how you generated your keys.

To test your setup, try to SSH into stargate.cs.usfca.edu without your password.

Authorize Stargate on CS Labs

The steps above will let you login to stargate.cs.usfca.edu remotely from your system, but then you need to login from stargate to a lab computer (like g1201) as well.

To start, SSH in to stargate.cs.usfca.edu and then SSH into any CS lab computer. If you are not asked for a password when you SSH into a CS lab computer, you can skip these steps.

On a CS lab computer, copy the contents of your *.pub key into the authorized_keys file on its own line. Since this is a copy between two local files, you should be able to use this command:

Replace keyname with the name of your public key before copy/paste.

Now, after you login to stargate.cs.usfca.edu without a password, you should be able to SSH into a lab computer without a password as well.