CS 212 Software Development

CS 212-01 • Spring 2020

COVID-19 Notice

Due to the COVID-19 outbreak, this website is being retired effective March 15, 2020. All future updates will be moved to Canvas for online instruction as advised by the university.

Configuring SSH Keys

Diagram

You will be accessing your Github repositories and CS lab computers for this course frequently. Specifically:

  • You will ssh into the CS Lab gateway (specifically stargate.cs.usfca.edu) from your laptop.

  • You will ssh into other CS Lab computers (such as g1201.cs.usfca.edu) from the gateway to run the homework and project grading scripts.

  • The CS Lab computers will need to use ssh to access your repositories on Github.

  • You can also use ssh to access your repositories on Github.

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

Diagram

You should first authorize our CS lab computers to access your Github repositories. This will allow the homework and project grading scripts to access your 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:

    1. 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.

    2. 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

Diagram

I recommend you follow the same process above on your own local laptop or computer system. You might have to change the OS for the instructions; 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

Diagram

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

Diagram

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.