SSH allows secure (encrypted and authenticated) connections between two hosts. These connections include terminal sessions, file transfers, TCP port forwarding, as well as X window forwarding which I will be covering here. X forwarding is a form of tunneling that allows you to run a GUI application on a remote machine but let you view and interact with it on your local machine.
To try this out you will need both X and SSH installed on your local and remote machines. Make sure that you are able to log into the the remote machine over SSH before you continue.
Simple SSH command, ensure that this works before continuing. You may have to enter a password for the user before it will allow you access.
$ ssh user@remotehost
The next step is to add the ‘-X‘ option. This will turn on X forwarding and allow you to remotely run X programs. In this case we will run xclock.
$ ssh -X user@remotehost xclock
You should see the xclock window appear on your screen. You can interact with it like any other local application window. Close it when you are done.
If you have a slower connection you can turn on compression by adding the ‘-C‘ option to the command above. This will compress all data communications with the gzip algorithm.
$ ssh -C -X user@remotehost xclock
If you are experiencing any problems turn on verbose output with the ‘-v‘ option. This will give you a lot more output and tell you what is going on underneath.
$ ssh -v -X user@remotehost xclock
If you are still having issues look in the ssh configuration file here/etc/ssh/ssh_config, and make sure that you don’t have X forwarding settings disabled.