1
0
mirror of https://github.com/tiyn/wiki.git synced 2025-10-09 09:27:53 +02:00

linux/ssh: fix x-forwarding sections

This commit is contained in:
tiyn 2025-09-22 01:34:54 +02:00
parent 3ecd487d85
commit 55bf7387f0

View File

@ -62,11 +62,17 @@ Host server
User user User user
``` ```
### Server Setup ### X-Forwarding
[Source](https://tutorials.rc.nectar.org.au/x11forwarding/02-enable-x11-on-virtual-machine) The following sections address the usage of X-forwarding which makes it possible to use graphical
For the server setup edit the file `/etc/ssh/sshd_config` and make sure X-Forwarding is enabled by programs remotely over SSH.
editing a line to look like the following.
#### Enabling X-Forwarding on a Server
This section is based on a
[blog by rc nectar](https://tutorials.rc.nectar.org.au/x11forwarding/02-enable-x11-on-virtual-machine).
For the server setup of X-forwarding edit the file `/etc/ssh/sshd_config` and make sure
X-forwarding is enabled by editing a line to look like the following.
```txt ```txt
X11Forwarding yes X11Forwarding yes
@ -78,27 +84,28 @@ Make sure to restart the SSH daemon afterwards by running the following command.
service sshd restart service sshd restart
``` ```
Afterwards X-Forwarding should be enabled on the server. Afterwards X-forwarding should be enabled on the server.
For full functionality install the `x11-apps` package aswell. For full functionality install the `x11-apps` package aswell.
#### Client Setup #### Enabling X-Forwarding on a Client
Auf dem Server ist das so genannte X-Forwarding aktiviert. To use X-forwarding when connecting use the `-C` flag as shown in the following example.
Das bedeutet, dass es möglich ist, graphische Programme aufzurufen und diese über eine SSH-Verbindung darstellen zu lassen.
Bei einem klassischen Login mittels des Terminals und dem `ssh`-Befehl kann dieser um die Flag `-C` erweitert werden
Der komplette Befehl sieht dann wie folgt aus, wobei sich der Name für `<host>` aus dem [Setup-Abschnitt](#setup) ergibt.
```sh ```sh
ssh -C <host> ssh -C <host>
``` ```
Die `-C`-Flag kann in der [`config`-Datei](#setup) vermerkt werden, sodass sie nicht extra angeführt werden muss. The `-C` flag can also be noted in the config file so that it does not have to be specified each
Dafür müssen die beiden folgenden Zeilen in die `config` unter dem entsprechenden Eintrag eingefügt werden. time.
This can be achieved by editing the config file which is located at `~/.ssh/config` and include the
following lines.
``` ```
ForwardX11 yes ForwardX11 yes
ForwardX11Trusted yes ForwardX11Trusted yes
``` ```
Die Funktion des X-Forwardings kann geprüft werden, indem man sich beim Server einloggt und dann `xclock` aufruft. The functionality of X-forwarding can easily be tested by running a graphical program when remotely
Bei korrekter Konfiguration sollte sich nun eine graphische Oberfläche öffnen, die die Uhrzeit anzeigt. connected.
An example for this could be the simple clock program `xclock`.