X11-Forwarding is a secure shell feature, which allows one to forward/tunnel X11 connections through an existing SSH session. This is used to run X11 programs on a server while the ssh-client displays the graphical window through the user’s X11-server. 0
In most cases, you will already have the required dependencies. At minimum, ensure that you have the following installed:
$ kiss b xorg-server
$ kiss i xorg-server
$ kiss b xauth
$ kiss i xauth
Configuring X11-Forwarding for a remote server is straightfoward and, once completed, a viable alternative to most opensource VNC and RDP server options. All that is required are a few modifications to configuration files that exist on your remote X server:
$ echo "XauthLocation /usr/bin/xauth" >> /etc/ssh/sshd_config
$ echo "X11Fordwarding yes" >> /etc/ssh/sshd_config
At this point you are ready to test your server!
In order to connect to your remote server, you will need an SSH client that supports X11-Forwarding, as well as an X server running on the same client. Some popular cross-platform options include the following:
From the client side, connect to the server via SSH through your favorite terminal application while passing the “-X” switch. Pay attention to any errors that may occur on connection. More verbose output can be achieved by passing the “-v” switch:
$ ssh -X -v user@localhost
You can now start any X program on the remote server, the output will be forwarded to your local session:
$ xclock
This should create a new window with the xclock application on your client side X server.
Use an “&” at the end of the command to prevent tying up the terminal in question:
$ xclock &
If your connection is slow, try enabling SSH compression by passing the “-C” switch.
$ ssh -X -C user@localhost
You can further improve your connection speed by using a cypher to connect to the remove server. This can be passed as an argument using the “-c” switch at the initialization of a new SSH connection 5.
$ ssh -X -C -c aes256-ctr user@localhost