I want to run a GUI application on a remote machine I only have ssh access to. I don't need to, or want to, see the GUI window. (I know I could use something like ssh -C -X remote_server if I wanted the GUI to be on my client.)
I know X is running on the remote machine, as ps shows this:
root ... /usr/bin/Xorg :0 -br -audit 0 -auth /var/gdm/:0.Xauth -nolisten tcp vt7
I set DISPLAY=:0.0 but I then get "Xlib: connection to ":0.0" refused by server" when I try to use it.
At Get remote x display working in linux without ssh tunneling and Xserver doesn't work unless DISPLAY=0.0 I see the advice to use gdmsetup to allow X to listen on TCP. But, gdmsetup is a GUI application! And trying to run it over ssh -X did not work ("X11 connection rejected because of wrong authentication").
So, is there a text file I can edit to remove -nolisten? And, after editing it, how do I safely restart X, remotely? (There is other stuff running on this machine, so requesting a reboot is possible, but undesirable.) If not, should gdmsetup be able to run over ssh and I should persevere in that direction?
UPDATE: I had to do the ssh -X session as root (ssh as a normal user, then sudo or su, does not work.) So, I did the edit with gdmsetup. I then restarted X with gdm-restart. I've also done xhost + from that ssh -X session. The ps line no longer shows the -nolisten tcp part. But still no luck connecting to it, with either DISPLAY=:0 or DISPLAY=localhost:0
UPDATE#2: I just noticed the reason xauth + hadn't helped (when done over ssh -X) was it altered my client machine, not the remote server! Oops. Good job I was inside the firewall! (I think the reason it had done this was related to the XAUTHORITY environmental variable, see Cougar's reply.)
xhost +to allow any user to access the X display, would that be enough? If so thenxhost +as the user that started X and theexport DISPLAY=:0on the remote machine should be enough to direct output to the remote X and save you having to see it – Paul Nov 22 '11 at 4:11xhost +but got xhost: unable to open display "". I then triedexport DISPLAY=:0.0and tried again and instead gotXlib: connection to ":0.0" refused by server,Xlib: No protocol specifiedandxhost: unable to open display ":0.0"– Darren Cook Nov 22 '11 at 8:04xhost +from – Paul Nov 22 '11 at 8:26xhost +to run now. But it still hasn't helped (see my UPDATE above). – Darren Cook Nov 22 '11 at 8:40