Skip to main content

3.2.1 ssh

ssh is used to log in to a remote computer. To log in to a remote computer (say, called ), a user sitting at his/her local machine would type:

 ssh -X 
where the userid must be your userid on the remote machine (this may be different to your userid on your local machine). The -X flag enables X-forwarding, which means that any X-application you run while remotely logged in will be displayed on your local terminal. For example, it allows you to start up an emacs window remotely. Without X-forwarding, remote logins are pretty limited.

At it's most simple, after typing in a command of the kind shown above, you will be prompted for your password on the remote machine (known as password authentication). If you enter the correct password, you will then be connected, and will have started a shell on that remote machine. All the shell commands you have encountered so far will work as normal. It's virtually like you're sitting in front of the terminal of the remote machine.

A more advanced implementation of ssh makes use key-based authentication (RSA authentication). In this case, you generate a public/private key pair. You upload a copy of your public key to a machine. From now on, when you try to login, the server uses your public key to send you a "challenge" that only the holder of your private key can answer. This scheme does have one flaw, anyone who gets hold of your private key can login as you. So you must be very careful about securing your private key. To login remotely to the CSC facilities, you will be given a private key (generated specifically for you) on a cd. When you obtain your ssh cd from CSC, be sure to read the information in doc/README-unix as is supplied on the cd.

As usual, there is extensive information in the man pages on ssh. Browse through these pages to find out about more options that can be used with ssh.