0

The problem

I am using an application that is computationally intensive and requires X11 to run. I want to run it on a remote server (that is obviously running X11).

I don't need to forward X11, I just need it to run on the server.

More details

If I run the application from the server (i.e. I use the keyboard that is physically connected to the machine), then everything works fine. My problem is that I want to start this application remotely (from an SSH connection) because I cannot always access the server physically.

I am not completely sure how it works, but when I run the following command from the machine (i.e. using its keyboard):

$ xhost +

then I can run my app ($ DISPLAY=:0 ./run-my-app) without problem from SSH. Now, I cannot run xhost + from SSH, and anyway it sounds like a bad idea in terms of security.

If I don't run xhost +, I get the following output:

No protocol specified

xauth: (argv):1: unable to open display ":0".

In conclusion, it looks like there is some security feature (access control) that prevents me from running the app on X11 remotely. But the point is that I don't want to have more than what happens when I start the app from the server (with the keyboard connected to the physical machine); I just want to start/stop it remotely, without any forwarding.

Is there a way to do that?

Similar questions

It looks similar to X11 on server without forwarding and How can I run Firefox on Linux headlessly (i.e. without requiring libgtk-x11-2.0.so.0)?, but in these situations they can use a virtual server like Xvfb, which does not work in my case. Moreover, I do have an X server running on the server, and I do need it.

1 Answers1

0

steal a copy of the enviroment of the running session

pid="`pgrep process_name\$ -U $USER`"
env `tr '\0' ' ' < "/proc/$pid/environ"` program_name

for a suitable value of process_name: something that you know is running in your X11 environment

Jasen
  • 3,761
  • The full command was not working for some reason, so I copied the output of tr '\0' ' ' < /proc/$pid/environ and ran env "<the_output_from_cat>" <program_name>, but I still get the same xauth error =(. – JonasVautherin Dec 21 '16 at 14:40
  • maybe try this instead tr ' \t\0' '__ ' or try snooping on a different process, – Jasen Dec 21 '16 at 18:12