Skip to content

Connecting through SSH

iliano edited this page Apr 30, 2026 · 1 revision

You should have already seen C0 working when you were directly logged in to a computer where C0 runs. But right now, you probably don't have C0 installed on your own machine (though you can do that), and because other utilities, like handin scripts, cannot be installed on your computer. SSH is a way of accessing the terminal of a remote linux server machine (like the cluster computers you used) where C0 is installed.

How SSH works

This task has two steps: first, you'll connect using a basic SSH connection, and second, you'll connect with "X11 forwarding," which lets you use visual applications and view images.

Connecting to a remote machine with SSH

If you're using Windows, you'll need to download a program to connect to a remote machine with SSH. We recommend MobaXterm.

If you're using OSX or Linux on your personal computer or laptop, you already have a terminal application. If you open the terminal and type:

% ssh your_andrew_id@unix.andrew.cmu.edu

Replace your_andrew_id with your actual andrew ID. So for instance, if my Andrew ID is fp, then I would type ssh fp@unix.andrew.cmu.edu. (In this and other examples, where you see the % symbol it indicates the command line prompt, and that's not something you should actually type.)

The ssh program will connect to a remote linux server where C0 is installed. After entering in your username and password, you will have a command line that works like a terminal window on the remote linux server.

Alternatively for all operating systems, for a modern editor-style environment, we recommend VSCode. Instructions for how to set up the editor for 15122 can be found here. Note that there are multiple viable options to connect with SSH, and the guide only mentions one option. See also the Guide to Success on VSCode on Diderot.

Use X11 forwarding

A terminal on the remote linux server is what you need to compile and run C0 programs and edit files. However, if what you want to do is view an image (something you'll want to be able to do for our image-based programming assignments), you want a way of to click on things with your mouse, rather than simply view text and type characters. "X11 forwarding" is the way we do this.

If you're connecting to unix.andrew.cmu.edu, then you'll know that you've gotten X11 forwarding working when you can run the following command and see a picture of an old-looking couch:

% display ~rjsimmon/public/couch.jpg &

On Windows, you will want to connect via MobaXTerm:

  1. Open MobaXterm and click the "Session" button in the top left corner of the window.
  2. Select SSH as the session type.
  3. Enter unix.andrew.cmu.edu as the Remote host, click the checkbox for "Specify username", and enter your andrew id in the field.
  4. Click "Ok" to connect via SSH, and enter your password when prompted. You may opt to save your password.

On OSX, you may need to download and install XQuartz first and then restart your computer after the installation finishes. Then you can add the -X or -Y flag (only use one of the two, use whichever one works) when you ssh to the remote linux server. Make sure you run this command from a new terminal window! It won't work if you're already logged in to a remote linux server.

% ssh -Y unix.andrew.cmu.edu
[enter username and password]
% display ~rjsimmon/public/couch.jpg &

On Linux, you should just be able to add the -X or -Y flag (only use one of the two, use whichever one works) when you ssh to the remote linux server. Make sure you run this command from a new terminal window! It won't work if you're already logged in to a remote linux server.

% ssh -X unix.andrew.cmu.edu
[enter username and password]
% display ~rjsimmon/public/couch.jpg &

If you are using VSCode, you are able to open images directly from the file explorer without additional steps.

Clone this wiki locally