Difference between revisions of "X2Go"

From ArchWiki
Jump to: navigation, search
(Configuring the server: add information to start and/or enable the services with systemd)
(31 intermediate revisions by 10 users not shown)
Line 1: Line 1:
[[Category:HOWTOs (English)]]
+
[[Category:Networking]]
[[Category:Software (English)]]
+
== Description ==
== x2go Server and Client ==
+
With x2go you can access your desktop using another computer -- that means both LAN and internet connections. The transmmission is done using the ssh protocol, so it is encrypted. By using the free nx libraries from NoMachine, a very acceptable permformance in both speed and responsiveness is archieved. Even an ISDN-connection runs smoothly.
+
  
This makes it is possible to connect your laptop to any computer with the environment, applications, and performance of the remote desktop. It is also possible to have a bunch of computers connected to one computer (terminal-server, thin-client).
+
With x2go you can access your desktop using another computer -- that means both LAN and internet connections. The transmission is done using the ssh protocol, so it is encrypted. By using the free nx libraries from NoMachine, a very acceptable performance in both speed and responsiveness is achieved. Even an ISDN connection runs smoothly.
  
Clients are available for Linux (Qt4 and Gtk), Windows and Mac.  The latter two can be downloaded directly from the x2go homepage.
+
This makes it is possible to connect your laptop to any computer with the environment, applications, and performance of the remote desktop. It is also possible to have a bunch of computers connected to a single server (terminal-server, thin-client).
  
=== x2go and Arch Linux ===
+
Clients are available for Linux (Qt4), Windows, and Mac. The latter two can be downloaded directly as binary from the x2go homepage.
Arch Linux x2go packages are available in the AUR. Currently the server, and the gtk/qt clients are available. The LDAP based usermanagement suite is not yet finished, nor are tools that make x2go more convenient for use in schools and thin client environments. But work is going on.
+
  
=== Installation and configuration ===
+
== x2go and Arch Linux ==
Packages needed from AUR: x2goserver and x2goclient and their
+
dependencies, the latter (nxcomp, nxproxy) have to be build first.
+
  
x2goagent depends on the compiled sources of nxcomp, nxcompext, and  
+
Arch Linux x2go packages are available in the AUR. Currently the server and clients are available. The LDAP based usermanagement suite is not yet finished, nor are tools that make x2go more convenient for use in schools and thin client environments.
nxcompshad. The easiest thing is to leave the src directories alone
+
after building each of the dependancies. The current x2goagent package
+
creates symbolic links to the dependancy packages.  The directory tree
+
should be laid out as follows:
+
./nxcomp/src
+
./nxcompext/src
+
./nxcompshad/src
+
./x2goagent (this is the one you build at the moment)
+
  
If all packages are successfully built, you install the following:<br>
+
== Installation and configuration ==
'''on the server(ex. your pc at home):''' x2goserver (plus dependencies)<br>
+
'''on the client, e.g. laptop:''' x2goclient (plus dependencies)
+
  
'''Configuring the Server'''<br>
+
{{Note|Arch Linux no longer supports initscripts. Because of this, we provide both the initscripts and the systemd ways of setting up the daemons. See [[Systemd#Transitioning_from_initscripts_to_systemd]] for help transitioning to systemd.}}
Given a working X-server plus Desktop-Environment (e.g. KDE) or window
+
manager, you have to do the following:
+
  
a) Install the ssh-daemon using
+
=== Configuring the Server ===
  pacman -Sy openssh
+
====Install the x2goserver package:====
 +
Install x2goserver from AUR (manually, with use of yaourt or other tools).
 +
 
 +
====Install the ssh-daemon:====
 +
'''With initscripts'''
 +
  pacman -S openssh
 
  /etc/rc.d/sshd start
 
  /etc/rc.d/sshd start
  
If the TCP-wrapper is active (see /etc/hosts.deny or
+
To have sshd started at boot time, you have to put it into the daemeons line in
/etc/hosts.allow), you have to include sshd there. To have sshd
+
started at boot time, you also have to put it into the daemeons line in
+
 
/etc/rc.conf, e.g.
 
/etc/rc.conf, e.g.
  
 
  DAEMONS=(... network ... sshd ...)
 
  DAEMONS=(... network ... sshd ...)
  
b) Load the fuse module to let the client access the directory in read
+
'''With systemd'''
and write mode on the server.
+
pacman -S openssh
 +
systemctl start sshd.service
  
modeprobe fuse
+
To have sshd started at boot time, you have to tell systemd to enable the service, like so:
  
To have this module loaded at boot time, you also have to put it into
+
systemctl enable sshd.service
the MODULES line in /etc/rc.conf, e.g.
+
  
c) Some users or groups have to get the rights to run a program as
+
====Load the fuse module:====
root.
+
This makes it possible for the server to access files on the client computer.
  
  pacman -Sy sudo
+
  modprobe fuse
visudo
+
  
An example for an entry in this file for all members of the group
+
To have this module loaded at boot time, you also have to put it into the MODULES line in /etc/rc.conf, e.g.
users:
+
  
%users ALL=(ALL) NOPASSWD: /usr/bin/x2gopgwrapper
+
====Initialize the SQL database (and start the SQL server):====
  
d) Initialize the SQL database and start the SQL server
+
You can choose to use either Postgres or SQLite database, the latter does not need a running server.
  
  /etc/rc.d/postgresql start
+
Initialize SQLite db:
 +
  x2godbadmin --createdb
  
This creates internally used tables of PostgreSQL. Now the x2go database
+
'''With initscripts'''
and its tables are created this way:
+
Start the x2goserver:
 +
/etc/rc.d/x2goserver start
  
cd /usr/lib/x2go
+
If you want to have this services started at boot time, include them in the DAEMONS line in /etc/rc.conf
./x2gocreatebase.sh
+
  
The SQL-server and the x2goserver have to be restarted:
+
DAEMONS=(... network ... sshd ... x2goserver)
  
/etc/rc.d/postgresql restart
+
'''With systemd'''
/etc/rc.d/x2goserver start
+
Start the x2goserver:
 +
systemctl start x2goserver.service
  
If you want to have this services started at boot time,,
+
If you want to have the x2go server started at boot time, tell systemd to enable it:
include them in the DAEMONS line in /etc/rc.conf
+
  
  DAEMONS=(... network ... sshd ... postgresql ... x2goserver)
+
  systemctl enable x2goserver.service
  
'''Configuration of the Client'''<br>
+
====Check SSH daemon configuration to allow non-English session:====
 +
 
 +
If you are using other than POSIX (C) locale, you may want to add the following line to /etc/ssh/sshd_config:
 +
 
 +
# Allow client to pass locale environment variables
 +
AcceptEnv LANG LC_*
 +
 
 +
'''With initscripts'''
 +
Then, restart the daemon (as root):
 +
/etc/rc.d/sshd restart
 +
 
 +
'''With systemd'''
 +
Then restart the daemon (as root):
 +
systemd restart sshd.service
 +
 
 +
== Configuration of the Client ==
 +
 
 +
'''Install the client:'''<br>
 +
X2goclient is available in AUR. It is a Qt GUI app, although you can also check-out the command line options by running
 +
 
 +
x2goclient --help
 +
 
 +
'''Double check ssh'''<br>
 
Convince yourself that you can open a ssh-session from the client to
 
Convince yourself that you can open a ssh-session from the client to
 
the server (host).  
 
the server (host).  
Line 97: Line 104:
 
* To prevent you from having the need to keep your public IP address in mind (especially if this changes dynamically) it is advisable to use a dynamic DNS-Service (DynDNS, DynIP). Many routers are preconfigured to be reachable under a name rather than an IP address.
 
* To prevent you from having the need to keep your public IP address in mind (especially if this changes dynamically) it is advisable to use a dynamic DNS-Service (DynDNS, DynIP). Many routers are preconfigured to be reachable under a name rather than an IP address.
  
Enough preliminaries! Now to the x2goclient. Run
+
'''Enough preliminaries! Now to the x2goclient. Run it:'''<br>
 
  x2goclient
 
  x2goclient
This opens the client application. Now you can create several sessions,
+
This opens the client application. You can now create several sessions, which then appear on the right side and can be selected by a mouseclick. Each entry consists of your username on the server, hostname and IP and the port for ssh-connection. Furthermore you can define several speed profiles (coming from modem up to LAN) and the desktop environment you want to start remotely.
which then appears on the right side and can be selected by a mouseclick. Each entry consists
+
of your username on the server, hostname and IP and the port for
+
ssh-connection. Furthermore you can define several speed profiles
+
(coming from modem up to LAN) and the desktop environment you want to
+
start remotely.
+
  
'''Easy made mistakes:''' Do not simply choose the defaults of KDE or Gnome,
+
'''Common mistakes:'''<br>
since the executables startkde or startgnome are usually not in the
+
Do not simply choose the defaults of KDE or Gnome, since the executables startkde or startgnome are usually not in the PATH when logging in using ssh. Use full paths to startkde or
PATH when logging in using ssh. Use full paths to startkde or
+
startgnome. You can also start openbox or another window manager.  
startgnome. You can also start openbox or another window manager.
+
  
You should be asked for your password for your user at the server now
+
You should be asked for your password for your user at the server now and after login you will see the x2go logo for a short time, and -- voila -- the desktop.
and after login you will see the x2go logo for a short time, and --
+
voila -- the desktop.
+
  
=== Exchange data between client and server(desktop) ===
+
'''Exchange data between client and server(desktop)'''<br>
On the x2goclient (e.g. laptop) local directories could be shared.
+
On the x2goclient (e.g. laptop) local directories could be shared. The server will use fuse and sshfs to access this directory and mount it to a subdirectory media
The server will use fuse and sshfs to access this directory and mount it to a subdirectory media
+
of your home directory on the server. This enables you to have access to laptop data on your server or to exchange files. It is also possible to mount these shares
of your home directory on the server. This enables you to have access
+
to laptop data on your server or to exchange files. It is also possible to mount these shares
+
 
automatically at each session start.
 
automatically at each session start.
  
=== To leave a session temorarily ===
+
'''To leave a session temorarily'''<br>
Another special feature of x2go is the possibility of suspending a
+
Another special feature of x2go is the possibility of suspending a session. This means you can leave a session on one client and reopen
session. This means you can leave a session on one client and reopen
+
it  even from another client  at the same point. This can be used to to start a session in the LAN and to reopen it later on a laptop.
it  even from another client  at the same point. This can be used
+
The session data are stored and administrated in a potges databse on the server in the meanwhile. The state of the sessions is protocolled
to to start a session in the LAN and to reopen it later on a laptop.
+
The session data are stored and administrated in a potges databse on
+
the server in the meanwhile. The state of the sessions is protocolled
+
 
by a process named x2gocleansessions.
 
by a process named x2gocleansessions.
  
== Outlook ==
+
== Various ==
At the moment the package consists mainly of the x2goserver and the
+
 
x2goclient. It is planned to add in near future:
+
'''Workaround for failing compositing window manager for remote session'''
 +
 
 +
This is useful for situations, when the computer running x2gserver is used also for local sessions with e.g. compiz as the window manager. For remote connections with x2goclient, compiz fails to load and metacity should be used instead. The following is for GNOME, but could be modified for other desktop environments. (Getting compiz ready is not part of this how-to.)
 +
 
 +
Create /usr/local/share/applications/gnome-wm-test.desktop:
 +
 
 +
[Desktop Entry]
 +
Type=Application
 +
Encoding=UTF-8
 +
Name=gnome-wm-test
 +
Exec=/usr/local/bin/gnome-wm-test.sh
 +
NoDisplay=true
 +
 
 +
Create script /usr/local/bin/gnome-wm-test.sh:
 +
 
 +
#!/bin/sh
 +
# Script for choosing compiz when possible, otherwise metacity
 +
# Proper way to use this script is to set the key to mk-gnome-wm
 +
# /desktop/gnome/session/required_components/windowmanager
 +
xdpyinfo 2> /dev/null | grep -q "^ *Composite$" 2> /dev/null
 +
IS_X_COMPOSITED=$?
 +
if [ $IS_X_COMPOSITED -eq 0 ] ; then
 +
    gtk-window-decorator &
 +
    WM="compiz ccp --indirect-rendering --sm-client-id $DESKTOP_AUTOSTART_ID"
 +
else
 +
    WM="metacity --sm-client-id=$DESKTOP_AUTOSTART_ID"
 +
fi
 +
exec bash -c "$WM"
 +
 
 +
Modify the following gconf key to start the session with gnome-wm-test window manager:
 +
 
 +
$ gconftool-2 --type string --set /desktop/gnome/session/required_components/windowmanager "gnome-wm-test"
 +
 
 +
== Future ==
 +
 
 +
At the moment the package consists mainly of the x2goserver and the x2goclient. It is planned to add in near future:  
 
* LDAP-Integration. This allow the administration of users, sessions and logins using LDAP. This is an interesting feature for schols or companys. For this purpose there are control programs which integrate themselves into the KDE Control Center.
 
* LDAP-Integration. This allow the administration of users, sessions and logins using LDAP. This is an interesting feature for schols or companys. For this purpose there are control programs which integrate themselves into the KDE Control Center.
* The client for the command line. Furtermore the option to use x2goclient as an login screen for thin clients.
+
* The option to use x2goclient as a login screen for thin clients.
* the possibility to use locale devices (CD, floppy, USB-stick) remotely and transparently.  
+
* The possibility to use locale devices (CD, floppy, USB-stick) remotely and transparently.  
  
 
Questions and problems? You could contact me also directly.
 
Questions and problems? You could contact me also directly.
Line 144: Line 173:
  
 
== Links ==
 
== Links ==
 +
 
[http://wiki.archlinux.de/?title=Bild:X2go-1.png Screenshot KDE-Session]
 
[http://wiki.archlinux.de/?title=Bild:X2go-1.png Screenshot KDE-Session]
  

Revision as of 21:04, 17 February 2013

Description

With x2go you can access your desktop using another computer -- that means both LAN and internet connections. The transmission is done using the ssh protocol, so it is encrypted. By using the free nx libraries from NoMachine, a very acceptable performance in both speed and responsiveness is achieved. Even an ISDN connection runs smoothly.

This makes it is possible to connect your laptop to any computer with the environment, applications, and performance of the remote desktop. It is also possible to have a bunch of computers connected to a single server (terminal-server, thin-client).

Clients are available for Linux (Qt4), Windows, and Mac. The latter two can be downloaded directly as binary from the x2go homepage.

x2go and Arch Linux

Arch Linux x2go packages are available in the AUR. Currently the server and clients are available. The LDAP based usermanagement suite is not yet finished, nor are tools that make x2go more convenient for use in schools and thin client environments.

Installation and configuration

Note: Arch Linux no longer supports initscripts. Because of this, we provide both the initscripts and the systemd ways of setting up the daemons. See Systemd#Transitioning_from_initscripts_to_systemd for help transitioning to systemd.

Configuring the Server

Install the x2goserver package:

Install x2goserver from AUR (manually, with use of yaourt or other tools).

Install the ssh-daemon:

With initscripts

pacman -S openssh
/etc/rc.d/sshd start

To have sshd started at boot time, you have to put it into the daemeons line in /etc/rc.conf, e.g.

DAEMONS=(... network ... sshd ...)

With systemd

pacman -S openssh
systemctl start sshd.service

To have sshd started at boot time, you have to tell systemd to enable the service, like so:

systemctl enable sshd.service

Load the fuse module:

This makes it possible for the server to access files on the client computer.

modprobe fuse

To have this module loaded at boot time, you also have to put it into the MODULES line in /etc/rc.conf, e.g.

Initialize the SQL database (and start the SQL server):

You can choose to use either Postgres or SQLite database, the latter does not need a running server.

Initialize SQLite db:

x2godbadmin --createdb

With initscripts Start the x2goserver:

/etc/rc.d/x2goserver start

If you want to have this services started at boot time, include them in the DAEMONS line in /etc/rc.conf

DAEMONS=(... network ... sshd ... x2goserver)

With systemd Start the x2goserver:

systemctl start x2goserver.service

If you want to have the x2go server started at boot time, tell systemd to enable it:

systemctl enable x2goserver.service

Check SSH daemon configuration to allow non-English session:

If you are using other than POSIX (C) locale, you may want to add the following line to /etc/ssh/sshd_config:

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

With initscripts Then, restart the daemon (as root):

/etc/rc.d/sshd restart

With systemd Then restart the daemon (as root):

systemd restart sshd.service

Configuration of the Client

Install the client:
X2goclient is available in AUR. It is a Qt GUI app, although you can also check-out the command line options by running

x2goclient --help

Double check ssh
Convince yourself that you can open a ssh-session from the client to the server (host).

ssh YourUsername_onServer@yourhost_or_ip

Within the local network this should not be a problem. The way you connect from beyond your network, lets say the internet, to your comuter at home is a question of how your network is build up. This would go beyond the scope of this article. Therefore here only a few items:

  • A port has to be opened at the router resp. gateway which forwards requests to your server, and there especially to the sshd-port (which normally is 22). To prevent a big part of the portscan attacks it is probably better to have 222 as publicly reachable port.
  • To prevent you from having the need to keep your public IP address in mind (especially if this changes dynamically) it is advisable to use a dynamic DNS-Service (DynDNS, DynIP). Many routers are preconfigured to be reachable under a name rather than an IP address.

Enough preliminaries! Now to the x2goclient. Run it:

x2goclient

This opens the client application. You can now create several sessions, which then appear on the right side and can be selected by a mouseclick. Each entry consists of your username on the server, hostname and IP and the port for ssh-connection. Furthermore you can define several speed profiles (coming from modem up to LAN) and the desktop environment you want to start remotely.

Common mistakes:
Do not simply choose the defaults of KDE or Gnome, since the executables startkde or startgnome are usually not in the PATH when logging in using ssh. Use full paths to startkde or startgnome. You can also start openbox or another window manager.

You should be asked for your password for your user at the server now and after login you will see the x2go logo for a short time, and -- voila -- the desktop.

Exchange data between client and server(desktop)
On the x2goclient (e.g. laptop) local directories could be shared. The server will use fuse and sshfs to access this directory and mount it to a subdirectory media of your home directory on the server. This enables you to have access to laptop data on your server or to exchange files. It is also possible to mount these shares automatically at each session start.

To leave a session temorarily
Another special feature of x2go is the possibility of suspending a session. This means you can leave a session on one client and reopen it even from another client at the same point. This can be used to to start a session in the LAN and to reopen it later on a laptop. The session data are stored and administrated in a potges databse on the server in the meanwhile. The state of the sessions is protocolled by a process named x2gocleansessions.

Various

Workaround for failing compositing window manager for remote session

This is useful for situations, when the computer running x2gserver is used also for local sessions with e.g. compiz as the window manager. For remote connections with x2goclient, compiz fails to load and metacity should be used instead. The following is for GNOME, but could be modified for other desktop environments. (Getting compiz ready is not part of this how-to.)

Create /usr/local/share/applications/gnome-wm-test.desktop:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=gnome-wm-test
Exec=/usr/local/bin/gnome-wm-test.sh
NoDisplay=true

Create script /usr/local/bin/gnome-wm-test.sh:

#!/bin/sh
# Script for choosing compiz when possible, otherwise metacity
# Proper way to use this script is to set the key to mk-gnome-wm
# /desktop/gnome/session/required_components/windowmanager
xdpyinfo 2> /dev/null | grep -q "^ *Composite$" 2> /dev/null
IS_X_COMPOSITED=$?
if [ $IS_X_COMPOSITED -eq 0 ] ; then
    gtk-window-decorator &
    WM="compiz ccp --indirect-rendering --sm-client-id $DESKTOP_AUTOSTART_ID"
else
    WM="metacity --sm-client-id=$DESKTOP_AUTOSTART_ID"
fi
exec bash -c "$WM"

Modify the following gconf key to start the session with gnome-wm-test window manager:

$ gconftool-2 --type string --set /desktop/gnome/session/required_components/windowmanager "gnome-wm-test"

Future

At the moment the package consists mainly of the x2goserver and the x2goclient. It is planned to add in near future:

  • LDAP-Integration. This allow the administration of users, sessions and logins using LDAP. This is an interesting feature for schols or companys. For this purpose there are control programs which integrate themselves into the KDE Control Center.
  • The option to use x2goclient as a login screen for thin clients.
  • The possibility to use locale devices (CD, floppy, USB-stick) remotely and transparently.

Questions and problems? You could contact me also directly. GerBra

(Many thanks to Stefan Husmann for translation from archlinux.de wiki)

Links

Screenshot KDE-Session

Screenshot configuration dialog

Project page