Running Remote X Sessions
Every server we access here is via ssh. On occasion I need to run X on a server and display this back to my desktop. In the past I have been doing this insecurely due to NOT tunnelling my X session over ssh, I would have to mess around setting xhost + on the local machine and setting the DISPLAY variable on the remote server.
So to securely run a remote X session ensure you have the following set in both ssh_config on your LOCAL machine and in sshd_config on the remote server
ForwardX11 yes
Interestingly when you log in to the remote server you should see your display automatically set to:
localhost:10.0
Final tip is that if you ssh as user A but want to run a remote X session as user B, copy the
~/.Xauthority
From yourself to the user you are interested in and manually set your display variable:
export DISPLAY=localhost:10.0

