Thursday, August 25, 2011

How to display any X-windows app remotely?

1st Method:

For this, your ssh configuration needs to be set so that you forward X11 requests. This is very easy to do globally. On your local machine, open or create the file ~/.ssh/config and write the following at the top:

ForwardX11 yes

That will try to forward X11 requests no matter who you connect to. It sets the DISPLAY variable correctly and does all the hard work. Note that you should remove any DISPLAY variable in your .bashrc file on the remote server, because it might conflict with what SSH tries to do automatically.

You should now be able to run any GUI application remotely over ssh.

2nd Method:

SSH using the "-X" option. For example:

ssh -X user@machine

The 1st method is the best because it's a one time setting that has to be done.