C0 | Documentation
About Downloads Tutorial References Courses
C0 Tutorial C0 and other languages Other references

Connecting through SSH

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 PuTTY. Alex Cappiello has instructions for setting up PuTTY here.

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.

Use X11 forwarding

A terminal on the remote linux server is what you need to compile and run C0 programs and edit files with Emacs or Vim. However, if you 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 viewing images and clicking your mouse on things, rather than a way to 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 download X-Win. Alex Cappiello's PuTTY instructions explain how to get PuTTY working with X11.

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 &