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

You should have received an email from Nic Dodds that contains your username for the server and a temporary password. If you have not received that email, let us know immediately!

  • LHS Cow speaking

    If you have already followed the instructions in that email and successfully changed your password, you can skip to the next part.

If you are trying to connect from off-campus you'll need to use a VPN to connect to the server.

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 is replaced by your actual username (e.g., first initial + last name). It will ask for your old password (i.e. the temporary password you were given) and then ask you to pick a new password. Then it will disconnect you immediately.

  • 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!

Important: 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 that the server will be hacked and become unusable for everyone, even though this isn't a particularly "important" computer.

Log in and Configure Git

Run the same command ssh <username>@cs70.cs.hmc.edu and log in with your new password. You should see a big "CS 70" and get a prompt (e.g. ~ SERVER >) saying that you are currently in your personal home directory (a.k.a. ~ or /home/<username>) and asking you for a command to run on the remote server.

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/.
  • ls
  • Should show you the contents of your home directory, including sub-directories "data" and "cs70".

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

  • git config --global user.name "Your Name Here"
  • git config --global user.email "Your Email Address @ Here"

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.

Log Into the Server Using VS Code

At this point we will switch to using the VS Code editor to connect to the server instead of using the ssh command. This way you'll be able to transparently work on files on the server without having to copy files back and forth.

  • Rabbit speaking

    VS Code still uses ssh behind the scenes!

Open VS Code on your computer (or a CS Lab computer). This gives you an editor for files on the hard drive of the computer you are using.

Now click on the >< button in the lower left corner. In the pop-up menu, select "Connect to Host" and enter <username>@cs70.cs.hmc.edu for the host (where is replaced by your CS 70 server username from above). When prompted, enter your server password (that you set above).

A new "remote" window will pop up! This window is essentially running on the remote computer cs70.cs.hmc.edu, so you can edit files on the server hard drive and get a prompt to run commands on the server.

  • LHS Cow speaking

    It might be a little bit slow at first as it initializes the remote connection.

  • RHS Cow speaking

    It should get smoother once that's done!

  • Hedgehog speaking

    I need help again!

  • LHS Cow speaking

    Sure thing. See if this video of Prof. Bang doing this helps (though he's using cs131.fun instead of cs70.cs.hmc.edu).

Once you have the remote window, go ahead and close the other (local) window. You won't need it and it might confuse you!

Check that VS Code is Running on the Server

Open a terminal to get a command-line prompt inside VS Code (via the View > Terminal menu option, or the Control-keyboard shortcut). Run the commandhostname` and verify that the terminal is running on the server.

To Complete This Part of the Assignment...

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

(When logged in, completion status appears here.)