1

I have a desktop machine running Debian 8.0 that I have ssh access to. I run a graphical application on this machine remotely, so I would just leave my desktop session open, ssh into the machine, and run:

DISPLAY=:0.0 ./my-application

Unfortunately, the machine was recently rebooted and my desktop session ended, therefore I can't access the DISPLAY anymore, as it is currently displaying the login screen of kdm-greet.

Is there either a mechanism to remotely login to a graphical session, or to start a second DISPLAY to run my application into? Note that I cannot do X11 forwarding to use my local display.

  • Not really. Here I can't use X11 forwarding, as the machine explicitely disable SSH X11forwarding (company policy) and it would make the application too slow. – Louen Sep 11 '18 at 21:29
1

Install a VNC server such as tigervnc. Start it as root, forward the port (this is not X11 forwarding, so you should be able to do this unless they ban it separately), then connect to it. You should see the login screen. Log in. Then, running DISPLAY=:0.0 ./my-application should work normally, as at that point, it's just like you had logged in locally.

Alternatively, if you don't have root, you can use a different VNC server, such as vnc4server, that makes a new DISPLAY instead of attaching to the existing one. Then just use whatever number it gives you for your program.

1

If you don't need to interact with the program (but it still needs an X server for some reason), you could use XvFB - the virtual framebuffer display. I find this very useful for running my UI program on build machines (mainly auto-tests, and generating product screen-grabs in a selection of languages).

On most distributions, it's available as xvfb:

Description: Virtual Framebuffer 'fake' X server

Xvfb provides an X server that can run on machines with no display hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory. The primary use of this server was intended to be server testing, but other novel uses for it have been found, including testing clients against unusual depths and screen configurations, doing batch processing with Xvfb as a background rendering engine, load testing, as an aid to porting the X server to a new platform, and providing an unobtrusive way to run applications that don't really need an X server but insist on having one anyway.

This package also contains a convenience script called xvfb-run which simplifies the automated execution of X clients in a virtual server environment. This convenience script requires the use of the xauth program.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.