Remote computers

Last update: 22 Nov 2024 [History] [Edit]

For most ATLAS work, you will usually want to connect to a remote computer rather than working directly on your own laptop. This is because remote servers usually have more resources available an have ATLAS software already installed.

Quickstart

We will work on the CERN lxplus server unless your instructor informs you otherwise. To log into lxplus from terminal, use:

ssh -Y -C <cern-username>@lxplus.cern.ch 

tip From a Linux laptop you should instead use -X (upper case X) instead of -Y in the ssh command.

Directories

In order to keep all of your tutorial work in a single place, create a dedicated directory. You can name it however you want, but we will assume it is called tutorial.

mkdir tutorial

Throughout this tutorial, you will create and navigate to multiple directories within tutorial. Whenever something needs to be done in a particular directory, it will be indicated with the dir icon along with the path starting with tutorial. Make sure to cd into that directory.

tip You’ll need around 50-100 MB of disk space for the tutorial. You should be able to use your ${HOME} space on lxplus if you wish. It is generally a good idea to use afs or some locally-mounted disk space (like tmp) for checking out and compiling code, and to use eos for large-file storage. Try to avoid writing directly to eos; instead, write during the job to some fast disk and copy the output at the end over to eos (eos likes big files written all at once). Some extra documentation is available on batch jobs, eos itself, and eos space in ATLAS.

Detailed discussion

Using terminal

To connect to a remote server using terminal, use the ssh command. The basic syntax is:

ssh [optional arguments] <username>@<server-address>

You will be prompted for your password and after successfully entering it, you will be logged into the remote computer. By default, you will begin in your home directory.

tip Any configurations from your computer will not be available on the remote computer, so you will need to set them up by hand.

tip If you have a slow connection to the remote computer (often due to physical distance or network traffic), use the argument -C to speed up the connection. This causes all information passed back and forth to be compressed. This option can slow down an already fast connection due to the compression step taking time.

X11 forwarding

X11 is a system that allows windows to be opened locally from a remote computer that you are connected to. This is particularly useful for opening any king of graphics, such as when drawing ROOT histograms.

You may need to install an X11 server on your personal computer. To test whether you already have one installed, use the xterm command on your local computer. If a new terminal-like window opens, X11 is installed. Alternatively you can usually use the xeyes command to open an interactive set of eyes.

If you do not have X11 installed, you should install it now. There are multiple X11 server options depending on your OS:

If you want to make use of the X11 functionality when connecting to a remote computer, use the -Y option (-X if you are using a Linux laptop). You can check that X11 forwarding is active with the xterm command on the remote computer.

tip xeyes is currently unavailable on lxplus and may not be available on whichever other remote machine you are using.

Config file

It is possible to store ssh configurations in a file to simplify connection commands. To do this, create/edit ~/.ssh/config. An example block is:

Host lxplus
    Hostname lxplus.cern.ch
    User <username>
    Compression yes
    ForwardX11 yes
    ForwardX11Trusted yes

warning Be sure to replace <username> with your username on the host computer.

With this configuration, you can connect to lxplus with the command:

ssh lxplus

This is equivalent to:

ssh -Y -C <username>@lxplus.cern.ch

Passwordless ssh

Whether you are logging into lxplus or another machine, it is possible to connect without needing to input your password every time using passwordless ssh.

VS Code

For details about connecting to a remote server using VS Code, please see the VS Code guide.