CS 70

Connecting to the CS 70 Server

C++ works slightly differently on every computer system; even slight changes in versions of the standard library, for example, can lead to big differences in observable behavior.

To make sure that the behavior you see matches what we see when we test your code, you'll be running your code on a remote server. The CS 70 server will have all of the libraries and tools you'll need to complete your assignments this semester.

Set Up Your CS 70 Server Account

We have created an account for you, username, on the CS 70 server (cs70.cs.hmc.edu), but there are a few things you'll need to do to get things set up.

Pick a New Password

When you log in for the first time, you'll be prompted to change your password. Take a moment right now to choose a strong password that you haven't used before and that you'll be able to remember. (If you have a password manager on your phone, it may be able to help you with creating a strong password and storing it securely in case you forget.)

  • Goat speaking

    How about goat42?

  • LHS Cow speaking

    No. It's really important that you pick a secure password. Bad actors constantly scan all computers connected to the internet (including cs70.cs.hmc.edu) and try to log in with hundreds or thousands of plausible usernames and passwords. If you pick a weak password then there's a high probability your account will be compromised.

  • Rabbit speaking

    And once hackers have a toehold on a machine, they can use that to scan the inside of the network and potentially access other machines as well, or exploit other vulnerabilities.

Log in for the First Time

The first time you log in, you'll use a temporary password that you'll be asked to change. You can click the button below to reveal your temporary password (every student has a unique temporary password, the one below is yours).

Open a terminal to get a command-line prompt (on your computer, or inside Visual Studio Code) and connect to cs70.cs.hmc.edu with the command

ssh username@cs70.cs.hmc.edu

where username needs to be your actual username on the server (e.g., first initial + last name).

When you log in, it will ask for your old password (i.e., the temporary password above, for a second time) and then ask you to pick a new password. Once you've changed your password successfully, the ssh connection will end. You can then try sshing in again using your new password, as described in the next section.

  • Hedgehog speaking

    Help! I'm confused!

  • LHS Cow speaking

    No worries; this will be new to many of you. Check out this video where Prof. Bang does the same thing, though he's using cs131.fun and we are using cs70.cs.hmc.edu.

  • RHS Cow speaking

    If that doesn't get you going, please ask for help!

Log in and Configure Git

Run the same ssh command (i.e., ssh username@cs70.cs.hmc.edu) and log in with your new password. You should see a big “CS 70” banner and get a prompt (e.g., ~ SERVER >) which shows that you are currently in your personal home directory (a.k.a. ~ or /home/username) and waits for you to type a command to run.

Try these commands:

hostname
Should say that the machine where this command ran is cs70-server.
pwd
Should say that you are currently in your personal directory /home/username.
ls
Should show you the contents of your home directory, including the subdirectories data and cs70.

While you are logged in, run the following two commands to configure git:

git config --global user.name "your-name"
git config --global user.email "your-email@example.com"

where you put your own name and email address in the quotes.

  • LHS Cow speaking

    If you don't get an error message, everything worked!

  • Dog speaking

    Hooray!

Finally, you can end your remote session on the CS 70 server by running the command exit.

Connect the Server to GitHub

Your homework lives in a Git repository on GitHub, and you will be sending your work there from the server. Before you can do that, GitHub needs to know it is really you. GitHub stopped accepting passwords for this in 2021, so instead we use the GitHub command-line tool, gh, which is already installed on the server.

You only have to do this once. Once it is done, git push and git pull will simply work for the rest of the semester.

Run:

BROWSER=/bin/false gh auth login

It will ask you a few short questions. Choose GitHub.com, choose HTTPS as the protocol, and say yes when it offers to authenticate Git with your GitHub credentials. Then choose to log in with a web browser.

At that point gh will show you something like this:

! First copy your one-time code: XXXX-XXXX
Open this URL to continue in your web browser: https://github.com/login/device
  • Duck speaking

    But there's no web browser on the server!

  • LHS Cow speaking

    Correct, and that's exactly why it does it this way. Open that URL in the browser on your own computer, type in the one-time code it gave you, and approve the request. The server is watching, and it will notice when you're done.

  • Hedgehog speaking

    What if the code disappears off my screen?

  • LHS Cow speaking

    Press Control C to give up and run gh auth login again. The codes are short-lived and single-use, so there's no harm in getting a fresh one.

When it finishes, check that it worked:

gh auth status

It should tell you that you are logged in to github.com as your GitHub username.

Meet Your Editor

The editor on the CS 70 server is Helix, which you run by typing hx. It works in the terminal rather than in a window of its own, which takes a little getting used to if you have only ever used something like VS Code.

You do not need to learn it all now. We have written a short guide to the parts you actually need:

Have a quick look at it now, and keep it open in a browser tab while you work through the rest of this assignment.

To Complete This Part of the Assignment...

You'll know you're done with this part of the assignment when you've done all of the following:

(When logged in, completion status appears here.)