Connecting to Linux servers with x2go

X2go is an alternative to "ordinary" X11-connections; it can be used on Windows, Linux og Mac clients.

What is x2go?

X2go enables an X11 session to a Linux server from a local Linux, Windows or Mac machine. It's an alternative to Xwin32 or ssh -X, with some nice features.

  • You can suspend the connection to the server, and bring it back later.
  • X2go is fast (relatively so).
  • X2go uses ssh as a transport mechanism. If ssh works, x2go should work too.
  • X2go is free and open software, so you don't have to mess with license files or arbitrary restrictions.
  • X2go can run "X in a window", similar to remote desktop solutions, as commonly used with Windows servers.

Note: X11 has its own idea about who is server and who is client. In this text, "client" is your local desktop or laptop computer (and the x2go program you run on it); while "server" is the remote machine you are connecting to.

Getting started

Installing the client

If you have a RHEL machine with Geo setup, the x2goclient is probably installed already.

Otherwise, you can ask your IT staff to do it. For RedHat/Fedora:

sudo yum install x2goclient

For Debian/Ubuntu-type distros:

sudo apt install x2goclient

For Windows, Mac or other Linux distros, download and install the client from the x2go homepage. (For temporary admin rights for Windows, please contact the IT staff.)

For Mac's, you most likely also will need to install XQuartz.

Defining a session

Start the client, either from the GUI or by giving the command "x2goclient" in a terminal window. Unfortunately, the configuration window looks a bit different for various versions of the client, so you might have to look around a bit for the options.

The client will offer to create a new session configuration:

Screenshot of session config, login details

Type in the following:

  • The Session name, this is just an arbitrary name.
  • The remote machine to connect to, wessel.uio.no, pingo.uio.no, or mimi.uio.no is suggested.
  • Your username on the remote machine (UiO username).
  • If you have set yourself up with ssh keys, you can check the box for "Try auto login".

Remote connection?

If you are connecting from outside the UiO network, things are more complicated. For the time being you can use wessel, pingo, and wessel without further ado.  For other machines, you'll need to use a ProxyJump server, and/or perform 2FA. While x2go has provisions for both, I was unsuccessful in getting both to work!

Thus, there are two options:

  • Use VPN.
  • Use an ssh ControlMaster, as outlined here. Before you connect with x2go, log in from a terminal to the same server to complete authentication.

Session types

For the optimal "Session type", this will depend on where you want to connect to:

  • For mimi, we recommend running just a terminal. Just select "Single application" and "Terminal". You can start other applications from the terminal, e.g. Matlab.

Single application , Terminal

  • For other pingo, you can use a terminal, or the XFCE desktop:

Session Type = XFCE

(In principle, this works for mimi too, but is horribly slow!)

  • For wessel, select Custom desktop and type in /usr/bin/mate-session as "Command":

Custon desktop, /usr/bin/mate-session

MATE is a clone of Gnome2. Note that just choosing MATE as a Session type directly from the menu doesn't always work as intended.

Screen size

Look around in the tabs, you should find a place to choose initial size of the display. 1000x800 is a good start, the size can usually be changed as the session is running.

To toggle fullscreen in a session, hit Ctrl-Alt-F, but you might be better off by simply maximising the x2go session window.

Keyboard

As for keyboard setting, try "Auto-detect" or "Keep current keyboard Settings". If you have an ordinary Norwegian keyboard and the default doesn't work satisfactory, try layout = no and model = pc105/no.

Display DPI

If you plan to use old-type X11 fonts, you may want to select "Set Display DPI" to 100 (dots per inch).

Misc

Under the "Connection" tab, you can set connection speed. ADSL seems to work fine.

Please uncheck "Sound support"! It's cool if it works, but it fills up the server logs with nonsense error messages.

Likewise, "Client side printing support" and "Shared folders" may or may not work. This depends (among other things) on your firewall settings.

You can change the "baby seal" image if you want to. Click it and select an image.

Remember to click OK.

Starting a session

You should now have a window similar to this:

Click the grey blob with your newly created session. A new blob will appear in the blue area as x2go tries to start your session. A few things may happen first:

  • On Windows, you will be prompted to open the firewall. Click cancel, or see below.
  • You will be asked to accept the (proxy's and) server's host key. Do so.
  • Unless you have a functional ssh key live in the agent, you will be prompted for your password (or the key passphrase).

Then, the session should start. After a few seconds a new terminal window will pop up, or a window with a Mate/XFCE desktop. In the latter case, you should be able to find a menu and start terminal windows and other applications on the remote machine. It could eventually look like this (a very tiny desktop):

Back in the local x2goclient window, it should look something like this:

At the bottom there are there buttons (icons).

The circular one to the far right will kill the session. All your programs running on the remote machine (in this session) will be killed, and unsaved data will be lost.

The two vertical lines will suspend the session. The programs will continue running, and you can resume the session later – on the same or a different x2go client.

Share a folder. This didn't work for me.

The session can also be terminated by logging out of the remote terminal or desktop (i.e. Mate/XFCE).

If you check the "show details" box, some text will appear. This can be useful for debugging problems.

Firewall settings (Windows)

Upon first start on a Window machine, the x2go client will open several windows asking for permission to adjust the firewall settings.

This is only necessary if you want to share a folder, play sound, and forward a local printer. If you have administrator rights on the machine you can enable this if you want, but it is not required for an ordinary connection.

You will only be prompted for this once. If you change your mind later on you'll probably have to adjust the firewall settings manually (google that).

Bugs and limitations

According to the docs, Gnome itself will not work well (or at all).

A few things doesn't work, as already mentioned. Other quirks I have noticed are:

  • The x2goclient will confusingly prompt you for password after the session is suspended or terminated. Just press cancel. It probably won't work to reconnect at this point.
  • In Mate, emacs sometimes dies a few seconds after start. I don't know how to fix this. Run emacs in a terminal (emacs -nw), or use some other editor, like pluma.
  • Sometimes, certain keys won't work, like the arrow keys. This is annoying, but in many applications (like the shell), you can use C-f, C-b, C-n, and C-p as for emacs. This is often the case when a session is moved from one local machine to another.
  • In KDE (if you use that) there is a bug that prevents emacs from running. A quick workaround is to run "xrdb -load /dev/null" in a terminal, or see this page.
  • You can't have more than one active session to the same remote host! If you try to start another, you will be reconnected to one that's already running (unless you kill it). If you try this from a different local machine, the new local machine can take over the session from the first (even if it's configured differently on the second machine).
  • Sometimes the session will get stuck and unavailable. You might have to kill the session in the session manager, or even ssh in to the remote machine and kill all your x2go-related processes (with something like pkill -u `whoami` x2go).
  • If the network is flaky (as when you carry your laptop around), the session could become lost.

The upshot of all this: Save your work often, and always before you suspend, terminate or move the session. If your applications support checkpointing, consider using it.

If you find the black XFCE desktop background a tad depressing, you can set a different colour (google rgb.txt to find a list of valid X11 colour names):

xsetroot -solid "Navajo White"

If you find other bugs or useful tips, please let us know!

The server pieces

Unless you are an administrator, you can probably skip this.

The server (i.e. remote machine) software is installed with yum, it's in the EPEL repository for RHEL 7 & 8:

yum install x2goserver

The server will be run a remote application with ssh. It doesn't run as a daemon, so there are no services to start.

There are other x2go server components too, feel free to install them all:

yum list "x2go*"

Install the font package xorg-x11-fonts-100dpi, and why not the 75dpi as well:

yum install xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi

Also, install X11 stuff, KDE and/or MATE:

yum groupinstall x11 mate-desktop  # RHEL7
yum install xfce4-session xfwm4 xfce4-settings # RHEL8
yum install xfce4-about xfce4-datetime-plugin \
  xfce4-panel xfce4-pulseaudio-plugin xfce4-screenshooter \
  xfce4-taskmanager xfce4-systemload-plugin xfce4-terminal\
  xfce4-whiskermenu-plugin  # Still RHEL8
yum groupinstall x11 kde-desktop   # RHEL6

And of course, install whatever applications the users will need. Matlab, firefox, thunderbird, eog, python, libreoffice, etc...

When running for a user, the x2go server keeps session information (state, logs, etc) in a subdirectory under directory /tmp/.x2go-username/. This is not always cleaned up as a session is terminated, and will sometimes need manual purging. Most likely, old subdirectories here can be deleted. Also, to truncate a large, active log file:

# cp /dev/null session.log

(This doesn't interrupt continued logging.)

It is possible for a machine (say, a desktop workstation) to be both x2go server and client, but it will easily get confusing. I suggest you avoid that.

By Hans Peter
Published Mar. 9, 2015 4:58 PM - Last modified Jan. 5, 2023 11:12 AM