FAQ

How do I login to my workstation from off-campus?

You cannot SSH directly into your office workstation from off-campus as it is not publicly visible from external networks.

As a workaround, you can SSH into it via one of our SSH gateways.

To set this up, create the following file on your local machine, i.e. home computer or laptop:

$ touch ~/.ssh/config
$ chmod 600 ~/.ssh/config

Then open the file with your favourite text editor (nano/emacs/vim/gedit), and enter the following text:

Host <hostname_of_workstation>
  ProxyCommand ssh feynman.hpc.susx.ac.uk nc %h %p
  user <its_username>

Now you can type:

$ ssh $hostname_of_office_computer

Tip

If your home computer username is not the same as your ITS username (which is highly likely), see the next section on how to further refine this configuration.

Polishing this off

As a further extension of this idea, you can make this even more usable with the following adjustment.

Create an additional block in you ~/.ssh/config for the ssh gateway. I’m going to use feynman as the example. Also update the original block mentions above to look like the following,

Host feynman
  hostname feynman.hpc.susx.ac.uk
  user its_username

Host some_friendly_name
  ProxyCommand ssh feynman nc hostname_of_office_computer %p
  user its_username

Now you can type,

ssh some_friendly_name

and you will connect.

Tip

Note that some_friendly_name can be anything, so this pattern can be used for all of your connections around the university. It is like an alias for the connection. Simply copy the block beginning Host feynman as a template, eg: if you use apollo a lot instead of feynman you can do:

Host apollo
  hostname apollo.hpc.susx.ac.uk
  user its_username

Persistant sessions over SSH

When working remotely, you may from time to time experience disruption to your network connection. Usually this means that your state will be lost and you will have to reconnect and most probably have to restart your process.

To get around this, you can use a terminal multiplexer

If you are doing some work on a remote machine, the chances are you will at some point experience an interuption to your network connection while you are working, if you haven’t had this happen already.

At that point, all your state will be lost, you will have to reestablish your connection, find whatever you were doing, and either resume it if the software you were using can do such a thing, or else restart your process.

To get around this problem, you can use software known as a terminal multiplexer to provide some persistence to your remote sessions.

The most common software for this is GNUscreen or just screen as it is invoked.

Todo

...

Setting Default Shell

Although your job script looks like a normal shell script, there are some subtle differences you should be aware of:

  • The script is parsed by the batch system before being executed, to pull out

    options to be used by the batch system. These options are the same as flags passed to qsub ‘-q queuename etc’, but instead of having to specify them on the command line you can include them in your script like so

    #$ -q queuename
    #$ -S /path/to/shell
    
  • The default shell that is used to interpret your script is set by the ‘queue’ you submit to. This defaults to csh (not sure why...). To change this to bash, insert the following line in your submission scripts

    #$ -S /bin/bash
    
    or include -S /bin/bash as an argument to qsub
    

How to run batch job on a server with X11

If a program you need to use requires X11, but you want to run in batch, read this: http://stackoverflow.com/questions/1710853/how-to-run-r-on-a-server-without-x11-and-avoid-broken-dependencies/1710952#1710952

This is a workaround. The example given is for R:

xvfb-run R

How to proxy HTTP to the campus

If you need to access a private website, only viewable from campus:

Here are the steps:

  • Needed: – Terminal window – Firefox
  • In the terminal window run:

ssh -D 12000 username@feynman.hpc.susx.ac.uk

  • In Firefox:

Click to open the menu at the top (for me it’s top right) where all the preferences are –> Click on ‘Preferences’

You should get the preferences window pop up. Click the ‘Advanced’ Tab at the top, and then in there are another set of tabs: Click the ‘Network’ tab. In here click the ‘Settings’ button near the top under the ‘Connection; Configure how Firefox connects to the Internet’ section.

You then get another window pop up: Click the radio-button ‘Manual proxy configuration’ –> The boxes below will allow you to edit them, click on the box: ‘SOCKS Host:’ and enter: ‘localhost’, then in ‘Port:’ enter 12000.

Beneath this line tick the box for ‘SOCKSv5’ and ‘Remote DNS’.

Then click OK, and go to Firefox and search for what is my ip and you should get a number like 139.184.*.* if it worked.

This will now last until you close the SSH session in the terminal window.

To change firefox back to default go back to the last window and check the button ‘Use system proxy settings’.