2

This question already has an answer here:

Most people want to be able to forward a window through ssh to the machine they're logging in from. I want to do the opposite.

I'm on my desktop and I'm logging in via ssh to my server. The server is essentially a media center and its screen is my TV. I want to be able to start chromium-browser from my ssh session but have it display on the server - not on my local machine.

Only running chromium-browser & doesn't work and gives me the Gtk: cannot open display error. Do I have to set an environment variable on the server to "export the display to itself"?

marked as duplicate by Gilles, Braiam, slm Aug 19 '14 at 0:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Yes, an X program uses the DISPLAY environment variable to find out where it should send the display. When using SSH, your DISPLAY environment may be automatically set up to forward the DISPLAY back through the ssh connection to your client machine (you can check with echo $DISPLAY). If you are not running an X server on your local machine, your remote program will complain that it is unable to open the display.

You should be able to explicitly start your browser on the locally attached display using:

env DISPLAY=:0 chromium-browser &

:0 is shorthand for "the locally attached display number 0".

0

You need a running X server on your remote machine, and know what display it is configured to, I.e. DISPLAY=localhost:1

Do ssh into your server, export the display variable

export DISPLAY=localhost:1

Then start your GUI.

0

ssh has its own X forwarding feature as well. Maybe it needs to be set up in the sshd.conf, with the X11Forwarding On directive. In this case, you will have a preset DISPLAY environment variable, with that DISPLAY called X11 programs will be forwarded through your ssh cobnection and it will be encrypted. Next to that, you will be able to get X apps behind a NAT.

0

In any event, aside from properly setting the DISPLAY variable, using the ssh -X (or -Y) switch...are you sure that host is properly allowed to display remote material?

Make sure the remote hosts is authorized to send information to your display using the xhost command.

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