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, 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.)
How about
goat42
?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.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
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 ssh
ing in again using your new password, as described in the next section.
Help! I'm confused!
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 usingcs70.cs.hmc.edu
.If that doesn't get you going, please ask for help!
Log in and Configure Git
Run the same ssh
command (i.e., ssh
) 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/
) 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
andcs70
.
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.
If you don't get an error message, everything worked!
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 Microsoft's Visual Studio Code editor to connect to the server instead of using the ssh
command directly. VS Code will let you transparently work on files on the server without having to copy files back and forth from a terminal.
VS Code actually uses
ssh
behind the scenes!
Open the VS Code app on your computer (or a CS Lab computer). The first window that opens allows you to edit files on the hard drive of the computer you are using.
Click on the
for the host (where
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 stored on the server machine and run commands on the server.
VS Code might be a little bit slow at first as it initializes the remote connection. (It has to download a copy of itself to the server.)
Connecting should be smoother once that's done!
I need help again!
Sure thing. See if this video showing Prof. Bang connecting to the server with VS Code helps. (Although he's using
cs131.fun
instead ofcs70.cs.hmc.edu
, the basics are the same.)
Once you have the remote window, you can go ahead and close the other (local) window, as you won't need it.
Check that VS Code is Connected to the Server
Use the Control key instead of Command if you're not on a Mac. (The Control key should also work on a Mac, but using Command is more macOS-like.)
Using the Command ` keyboard shortcut, open a terminal to get a command-line prompt inside VS Code. (The terminal pane will typically pop up at the bottom of your window.)
menu option, or theRun the command hostname
and verify that the terminal is running on the server. (If it tells you you're on a machine that isn't the server, you're probably not in the remote window.)
(When logged in, completion status appears here.)