Терминальный сервер на ubuntu при помощи x2go
Содержание:
Adding this Repository to Your Package System
Bootstrapping the Repository GPG Keys
X2Go Packages for Debian and the repository metadata are signed with a GPG key to counter Man-in-the-Middle attacks. If you install X2Go components for the first time on a machine, you will have to bootstrap the repository and package signing key first in order for apt to validate the downloaded repository metadata and use it.
Please switch to a user which has administrator privileges on your system in your preferred command line client:
su -
or
sudo -s
The following command will ensure that your system will be able to work with the repository archive key.
$ apt-key adv --recv-keys --keyserver keys.gnupg.net E1F958385BFE2B6E
Adding the Actual Repository
Please add the file to the folder .
This can be done by using your preferred editor.
If you have not gotten a directory named add the lines to .
$ editor etcaptsources.list.dx2go.list
Then add the X2Go repository (binaries and sources) as a couple of new lines (example for Debian buster):
- x2go.list
-
# X2Go Repository (release builds) deb http://packages.x2go.org/debian buster extras main # X2Go Repository (sources of release builds) deb-src http://packages.x2go.org/debian buster extras main # X2Go Repository (Saimaa ESR builds) #deb http://packages.x2go.org/debian buster extras saimaa # X2Go Repository (sources of Saimaa ESR builds) #deb-src http://packages.x2go.org/debian buster extras saimaa # X2Go Repository (nightly builds) #deb http://packages.x2go.org/debian buster extras heuler # X2Go Repository (sources of nightly builds) #deb-src http://packages.x2go.org/debian buster extras heuler
Edit this new data and make sure to uncomment desired components and comment non-desired components. Only one group may be active at a given time.
While we do offer pseudo-codenames like , , and for convenience, you should not use them. Our pseudo-codename setup is not guaranteed to be in sync with Debian’s releases, so using the codename might mean that you will actually get packages for what Debian calls after a new Debian distro release for a considerable amount of time.
Switching between components usually requires uninstalling all X2Go packages first! The only upgrade path that is considered somewhat safe is main (release packages) to heuler (nightly packages), but there are no guarantees regarding the stability or usefulness of nightly packages.
Synchronize the Newly Added Repository’s Metadata
Please perform an update of your APT package database:
$ apt-get update
If you were unable to bootstrap the repository GPG key previously, apt-get will fail to validate the signatures and discard the downloaded repository metadata.
Not being able to verify signatures means that any content downloaded from the remote location could be injected/offered by a malicious third party and need not come from the X2Go Project. This includes repository metadata and any packages downloaded from unauthenticated repositories. Installing the x2go-keyring package from an unauthenticated repository bears the chance that this is not our package but a malicious third-party one which will not contain our public keys. This holds for all packages installed from this repository, now and later.
You can bypass apt’s internal checks if you understand the implications and are ready to take the risk by once using:
$ apt-get update --allow-insecure-repositories
Otherwise, please try to first fetch the key again as outlined in the bootstrapping instructions.
After the update you should be able to access the X2Go packages via the apt command family. As a first action you should install our package and refresh the apt cache:
$ apt-get install x2go-keyring && apt-get update
Step 3 — Installing the X2Go Client Locally
X2Go is ready to use out of the box. If you’re using Windows or Mac on your local machine, you can download the X2Go client software here. If you’re using Debian or Ubuntu you can install the X2Go client with this command on your local machine:
After downloading the software you are ready to install it. Open the installer and select your preferred language. Now agree to the license and let the wizard guide you through the remaining steps. Normally, there shouldn’t be any reason to change the pre-filled, default values in these steps.
X2Go works well out of the box but it is also highly customizable. If you’d like additional information, visit X2Go’s official documentation.
Now that the desktop client is installed, you can configure its settings and connect to the X2Go server to use your remote XFCE desktop.
Log File Watching
If you want to track down problems with the server-side components of X2Go, it is possible to enable output of debug information into the systems syslog facility (normally ).
The default log levels for and are set to . Available log levels are: emerg, crit, alert, err, warning, notice, info, debug.
While testing e.g. your X2Go server, you can open another terminal on the server and watch the file:
root@x2goserver:~$ tail -f /var/log/syslog | grep x2go
Other logging locations apart from the system’s log are:
-
X2Go Server:
- X2Go Client: stderr (use )
- PyHoca-GUI: stderr (use )
-
Xsession itself:
-
NX (server-side):
-
NX (client-side):
Server Set Up
Setting up an X2Go Host is different on every Linux distribution. It is because of this, we’ve broken down exactly how to get the server software running for the most popular Linux distributions. If you’re looking to get the X2Go server software working on your version of Linux, but find it hasn’t been covered below, it’s a good idea to check your operating system’s package manager, or the X2Go website for a downloadable source archive.

Using X2Go requires using SSH. Please set up SSH, along with X11 forwarding before following this guide.
Ubuntu
X2Go has two parts. On Ubuntu, only the client is present. This is irritating, if you’re looking to host an X2Go session. To fix this, community members have taken it upon themselves to create a PPA that users can add to quickly add the server component. The PPA isn’t specific to the desktop versions of Ubuntu. If you’re looking to set up X2Go hosts on an Ubuntu server box, it’ll work just fine. Furthermore, the PPA will work on all Ubuntu derivatives (think Elementary and Mint, etc).
Open a terminal, and add the X2GO PPA:
sudo apt-add-repository ppa:x2go/stable
Then, update Ubuntu’s software sources with apt update.
sudo apt update
When the software sources for Ubuntu are up to date, install the software.
sudo apt-get install x2goserver x2goserver-xsession
These two packages should be everything you need. That said, if you use Lubuntu or Ubuntu Mate, there are some additional packages to install. These are desktop-specific bindings.
Ubuntu Mate:
sudo apt-get install x2gomatebindings
Lubuntu:
sudo apt-get install x2golxdebinding
Installing these packages to Ubuntu will automatically set up an X2Go server session. Everything is done within the install process, and nothing needs to be tweaked.
Debian
Though Debian shares the same package base as Ubuntu, there is no easy way to get the X2Go software repos working. Instead, you’ll need to tweak some things manually. Start off by adding the repo key. This is important, as Debian will not install software that isn’t trusted.
sudo apt-key adv --recv-keys --keyserver keys.gnupg.net E1F958385BFE2B6E
With the key added, it’s time to add the actual software repo.
Note: Not using Debian 9.2 Stable? Change “stable” with whichever version of Debian you are running.
echo 'deb http://packages.x2go.org/debian stable main' | sudo tee /etc/apt/sources.list.d/x2go.list
After adding the software source, update Debian to reflect the changes.
sudo apt-get update
Lastly, install the X2Go server tools to get everything working.
sudo apt-get install x2goserver x2goserver-xsession
Arch Linux
Arch Linux manages to support the X2Go server software via the Community repository. To install it, use the Arch package manager.
sudo pacman -S x2goserver
With the software installed, create a new database for X2Go:
sudo x2godbadmin --createdb
Lastly, enable the server software in systemd (and start it too).
sudo systemctl enable x2goserver.service sudo systemctl start x2goserver.service
Fedora
X2Go is well supported on Fedora. Install it like any other package, using the dnf install command.
sudo dnf install x2goserver x2goserver-xsession
Then, create the database that X2Go will use (if Fedora doesn’t do it for you).
sudo x2godbadmin --createdb
Lastly, enable the service with systemd.
sudo systemctl enable x2goserver.service sudo systemctl start x2goserver.service
OpenSUSE
The X2Go server software is available for installation via the developer’s own software repositories. Here’s how to add it:
sudo zypper ar http://packages.x2go.org/opensuse/SUSE-VERSION/extras x2go-extras
and
zypper ar http://packages.x2go.org/opensuse/SUSE-VERSION/main x2go-release
After adding the software repos, install the packages to your system:
sudo zypper in x2goserver x2goserver-xsession
Create the database for X2Go. The SUSE packages may (or may not) take care of this. If X2Go doesn’t work, that’s a sign to just do it yourself, using the terminal.
sudo x2godbadmin –createdb
With everything installed, enable X2Go within the systemd init system.
sudo systemctl enable x2goserver.service sudo systemctl start x2goserver.service
X2Go’s Server: How it actually works
Starting a New Session
When starting a new session the script called gets executed on the server. creates a new session in three phases:
- Find unique number and unique session ID. This will insert a new session in the database.
- Find free ports for sound, graphic, file sharing. After that the the database entry will get updated with these discovered values.
- Start (NX-like XServer): after that the database entry gets updated with the PID of the process.
CAVEAT for client implementations: if you query the session entry from the database with some time between phases 1 and 3 some of the returned values (ports, agent PID) will not be set.
Enable Debug Output
The log level can be set by editing:
root@x2goserver:~$ editor /etc/x2go/x2goserver.conf
Debugging cups-x2go
For debugging cups-x2go there are two files to look at:
- — in case code has a bug (e.g. a syntax error) or fails otherhow
- — in case anything goes wrong while is processing a print job
For setting the log level of your CUPS server, please investigate the man page:
$ man cupsd.conf
The log level can be set by editing:
root@printserver:~$ editor /etc/cups/cups-x2go
Debugging X2Go Session Broker
The debug mode can be enabled in:
root@broker:~$ editor /etc/default/python-x2gobroker
The log files normally get written to
You can also run
root@broker:~$ x2gobroker-daemon-debug
as user . This is equivalent to running the broker daemon provided by the package , but you will see all output piped to stderr while the X2Go Session Broker daemon runs in foreground mode.
Python X2Go / PyHoca Debugging
The PyHoca clients both have a option. Run or from the command line with that option enabled and you get blasted with debug output.
Desktop Bindings for MATE (v1.x)
X2Go bindings for MATE (package name: ) will add additional X2Go-related functionality to your MATE Desktop.
Usage
X2Go MATE desktop bindings take care of mounted X2Go shares (local client folder sharing). If a client share is mounted via your X2Go client application, a desktop icon appears that allows the user to start MATE’S file browser opening the mounted (SSHFS) share.
The X2Go MATE desktop package defines a set of desktop icons and MIME types so that mounted client shares get associated to opening Caja.
The X2Go MATE desktop bindings package also adds a context menu item that allows the X2Go session user to unmount shared client folders by right-clicking on their desktop icons.
The X2Go MATE desktop bindings package furtheron adds a Systen menu item to your MATE panel. Users will be able to suspend their X2Go sessions with just a click on a menu entry: System → Suspend X2Go Session.
Configure Client Settings
Keyboard Shortcuts
X2Go follows the general keyboard shortcuts of the NX client. In particular:
- Ctrl + Alt + T: terminate session / disconnect
- Ctrl + Alt + F: toggle windowed/fullscreen over all screens
- Ctrl + Alt + Shift + F: toggle windowed/fullscreen on current screen
- Ctrl + Alt + M: minimize or maximize fullscreen window
- Ctrl + Alt + arrow keys: move viewport (when remote screen is bigger than client window)
- Ctrl + Alt + G: toggle autograb feature (pass all key to the x2go session when it is active; this helps with window cycling using Alt+Tab)
- more to find in “/etc/x2go/keystrokes.cfg”
- locate “README.keystrokes.gz” on your system to read the keystrokes documentation
Some of these keyboard shortcuts overlap with default shortcuts of e.g. GNOME. See Customize NX Keyboard Shortcuts for a method to change the X2Go shortcuts.
The server pieces
Unless you are an administrator, you can probably skip this.
The server (ie. remote machine) software is installed with yum, it’s in the EPEL repository for RHEL 6 & 7:
yum install x2goserver
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 groupinstall x11 kde-desktop # RHEL6
And of course, install whatever applications the users will need. Matlab, python, etc…
X2Go’s Server: What is it? What does it do?
The base X2Go Server and also the X2go Server Extensions are basically a collection of Bash and Perl scripts that take care over X2Go server session management and communication between client and server.
X2Go server currently uses NXv3 based libraries and tools for the backend implementation of X2Go (graphical compression & caching for low bandwidth connections).
The individual X2Go Server scripts do have (rudimentary) man pages. Some of the X2Go server scripts are used internally (by other X2Go server scripts), others are designed to be available to X2Go Client implementations (e.g. , , , etc.).
Step 2 — Installing X2Go on the Server
X2Go comes with two main components: the server, which starts and manages the graphical session on the remote machine, and the client, which you install on your local computer to view and control the remote desktop or application.
In previous versions of Debian, wasn’t included in the default repositories, so you’d have to follow steps like these to get the software package. We’re leaving the link here, just for reference, in case the package gets dropped in future versions of Debian. Fortunately, Debian 10, codenamed Buster, includes the package you need in its default repositories, so the installation is a bit easier.
To install X2Go on your server, type the following command:
At this point, no further setup is required on your server. However, keep in mind that since SSH password authentication is disabled, for increased security, you’ll need to have your SSH private key available on any machine that you want to log in from. This will be the case if you followed the recommendation of setting up SSH keys in the Initial Server Setup with Debian 10 tutorial listed in the prerequisites. If you didn’t, you can still log in with a password, but make sure you choose a strong one.
Remember that if you run out of RAM, some applications might be abruptly terminated by the Linux kernel, and then you could lose work in progress. If you are using a DigitalOcean Droplet and you notice that your programs require more RAM, you can temporarily power off your Droplet and upgrade (resize) to one with more memory.
You are now done setting up the server and you can type or close the terminal window. The rest of the steps will focus on configuring the client on your local machine.
What is x2go?
X2go enables an X11 session to a remote Linux machine 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 remote machine, 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.
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.
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.
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).
If you start a session on a PC-type local machine, and move it to a Mac (or vice versa), the keyboard settings will probably be messed up.
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 other bugs, or ways to fix or work around these bugs, please let us know!
Шаг 4 — Подключение к удаленному рабочему столу
При первом открытии клиента X2Go должно появиться окно. Если не появится, нажмите вкладку Session в меню вверху слева и выберите New session … (Новый сеанс).

В поле Session name (Имя сеанса) введите что-то, что поможет отличать серверы друг от друга
Использование имени сеанса особенно важно, если вы планируете подключить несколько компьютеров
Введите IP-адрес вашего сервера или полное доменное имя (FQDN) в поле Host в разделе Server.
Введите имя пользователя, которое использовалось для подключения SSH в поле Login.
Так как на шаге 2 вы установили XFCE, выберите в качестве типа сеанса Session type.
Так как вы подключились к серверу с помощью ключей SSH, то в заключение нажмите значок папки рядом с Use RSA/DSA key for ssh connection и выберите ваш закрытый ключ. Если вы решили не использовать защитные ключи SSH, оставьте это поле пустым. Клиент X2Go будет запрашивать пароль при каждом входе.
Пока вам достаточно настроек по умолчанию, но по мере того, как вы будете разбираться с данным ПО, вы сможете настраивать клиент в соответствии с вашими индивидуальными предпочтениями.
Нажмите кнопку OK. Теперь вы можете начать графический сеанс, нажав на белое поле с названием вашего сеанса, расположенное вверху справа.

Если вы работаете на OS X на вашем локальном компьютере, OS X может предложить установить XQuartz для запуска X11. В этом случае следуйте инструкциям по установке.
Через несколько секунд появится ваш удаленный рабочий стол, и вы сможете начать работу с ним.
В операционных системах Windows и Linux есть несколько полезных сочетаний клавиш, которые вы можете использовать для удобства.
Примечание. Первые два варианта могут работать некорректно на современных версиях Windows. Вы можете попробовать использовать их, если в более поздних версиях X2Go проблемы будут устранены. Если нет, просто не используйте эти комбинации клавиш в будущем.
включает и выключает полноэкранный режим. Работа в полноэкранном режиме может быть похожа на работу на локальном рабочем столе. При полноэкранном режиме сочетание клавиш будут захвачены удаленным устройством, а не локальным компьютером.
уменьшает удаленный просмотр, даже если вы находитесь в полноэкранном режиме.
закрывает сеанса, но графический интерфейс остается запущенным на сервере. Это быстрый способ отключения без выхода из системы или закрытия приложений на сервере. То же самое произойдет, если вы нажмете кнопку закрытия окна.
Есть два способа, как завершить удаленный сеанс и закрыть все графические программы, запущенные в нем. Вы можете удаленно выйти из меню запуска XFCE или же нажать на кнопку, отмеченную кружком и небольшой чертой (как значок «включено/спящий режим») в нижнем правом углу основной части экрана X2Go.
Первый метод — более чистый, но может оставить запущенными некоторые программы, например программное обеспечение для управления сеансами. Второй метод закроет все, но может сделать это принудительно, если процесс не может завершиться. В любом случае, прежде чем продолжить, не забудьте сохранить работу.

Теперь вы успешно получили доступ к удаленному рабочему столу и настроили его.