I have Ubuntu 14.04 and Fedora 20 as a test environment. I am trying to send X programs from Fedora to Ubuntu through an SSH session. My setup is as follows:

On Ubuntu ran:

Xhost +IP Address of Fedora

This returns: being added to access control list

From the Fedora system I then run:


This step redirects Fedora's Display to the Ubuntu system.

Then I ssh to Fedora from Ubuntu. At this point when I try to launch a program, such as gedit from the ssh prompt I get this: (and no gedit window appears)

Unable to init server: Could not connect: Connection refused (gedit:7358): Gtk-WARNING **: cannot open display:

HOWEVER, when I launch gedit directly from Fedora it appears on my Ubuntu system, albeit errors on the Fedora side:

** (gedit:7372): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-77RFAr0MHI: Connection refused

I should be able to launch the X based program from the ssh session and it appear on screen. Anyone know what I am doing wrong?


If you want to run the X apps over your ssh session you just need to tell ssh to carry the traffic. Don't run xhost and don't override DISPLAY.

ssh -Yf remote-host some-x-application

The -Y flag tells ssh to create a DISPLAY environment variable on the remote-host and carry the resulting traffic across the encrypted connection. The -f flag tells ssh to do all this in the background so that it looks like the session has terminated immediately.

If you prefer to have an interactive shell visibly running on the end of the ssh connection you can also do this sort of thing:

ssh -Y remote-host
...log in as necessary...

some-x-application &
another-x-application &

wait; exit
| improve this answer | |
  • Ok, that works, but is not exactly what I was hoping for. And actually, after re-reading the documentation I was following earlier, It does appear that I have to start the X app on the remote side first, which seems somewhat counterintuitive :/ but thanks for the tip! – user53029 Sep 1 '15 at 21:45
  • @user53029 where else would you expect to start the application? – roaima Sep 1 '15 at 22:03
  • From the ssh or telnet session on the "client/local" side. Use case being I have a low end system that can connect remotely to a server class system and consume its resources rather than mine for running apps however like I said after re-reading the documentation I think the app must be started from the "remote" side. – user53029 Sep 1 '15 at 22:08
  • @user53029 that's exactly what you do. Log on to the client. ssh to the server and run your application. – roaima Sep 1 '15 at 22:09
  • I understand. However if I run ssh -Yf <remote host> /usr/bin/firefox or whatever it brings the browser over but then closes the connection. Is there a way to keep it open and run more apps if needed or do I just keep starting up ssh tunnels? I am not aware of a way to do this with SSH which is why I was hoping the "xhost/display" method would work for me. – user53029 Sep 1 '15 at 22:13

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.