X / X11 forwarding over SSH - an alternative to remote desktop

The usual way to run remote systems graphically is through some kind of remote desktop service. Like VNC or remote desktop (RDP).

An alternative way is X forwarding which forwards remote application windows over SSH and displays them on the local system.

Example, with one Linux client and one Linux host:

Host:
/etc/ssh/sshd_config must contain X11Forwarding yes
xauth must be installed (apt-get install xauth)

Client:
~/.ssh/config. should contain:
Compression yes
ForwardX11 yes

How to use:
Login to the host as usual using SSH, for example: 
ssh examplehost -l username

Add -X if you haven't added X11Forwarding yes to your local config file:
ssh examplehost -X -l username

Then run a desktop application, like mate-terminal on the host. The program will pop up on your local machine if everything works as expected.

You may even start a full desktop session. For example, in MATE you run mate-session.

Add -C for compression.

References:
https://unix.stackexchange.com/questions/12755/how-to-forward-x-over-ssh-to-run-graphics-applications-remotely
https://ubuntuforums.org/showthread.php?t=1504404


Multiple hosts and compression

To use multiple hosts and compression on some, do this in the config file:

Host example.com
	Compression yes
	ForwardX11 yes
Host *
	ForwardX11 no

This is a personal note. Last updated: 2018-06-10 14:47:05.



LinkedIn
Klebe.se

Don't forget to pay my friend a visit too. Joakim