I'm trying to run a graphical program remotely, without using ssh. I've set the display variable on the server (let's say server.com, Linux, not ubuntu, and no su rights) to point to my workstation (workstation.com, ubuntu 10.04)

setenv DISPLAY workstation.com:0

Then on my workstation I've tried both

xhost +server.com


xhost +

Then I ssh into the server (to test things):

ssh username@server.com

and try to run xclock, and get the following error:

Error: Can't open display: workstation.com:0

I've looked at /etc/ssh/ssh_config on the workstation and I should be forwarding correctly: X11Forwarding yes.

How do I go about troubleshooting this?

What logs on the workstation document these failed attempts?

To explain why I'm doing this: I want to run a batch job on a server to debug an MPI-based parallel program. I want to run xterm as the batch job executable, per the instructions provided by the system admins.

This setup use to work. I reinstalled things on my workstation and since then I frequently get one-time message along the lines The authenticity of host 'hostname (XXX.XXX.XXX.XX)' can't be established.

My attempt to fix the above was to move my ~/.ssh/known_hosts file to a back up on both server and host, and then to ssh from each to the other with the flag -o StrictHostKeyChecking=no. I no longer get that message, but I was wondering does this play a part in why X11 forwarding is not working?

  • I was going to tag this with xhost but I don't have enough reputation to create the tag, so please feel free to adjust the tags as you see fit. – Yann May 23 '12 at 15:35
  • Is this question ubuntu enough, or should it be moved to unix.stackexchange.com? – Yann May 23 '12 at 15:36

I have the same issue on the remote server. Try the following:

  1. Add the following to your sshd_config:

    AddressFamily inet
  2. Restart SSH

(Ref: http://www.linuxquestions.org/questions/ubuntu-63/cant-open-display-882197/)

up vote 1 down vote accepted

It is a firewall issue. TCP (port 6000) was being blocked, always, and no matter what I did with xhost, XAuthority, etc. the forwarding was not happening.

I adjusted the firewall settings using the utility Firewall Configuration, found in the System > Administration menu.

  • how do you do this in terminal? – user1872384 Jan 14 '16 at 10:15
  • @user1872384 I'm not sure, I would ask a new question and you'll get more help that way. – Yann Jan 14 '16 at 13:53
  • I've managed to solved it. Mine is not cause by this.. Thank you so much Yann. I just need to use -X when ssh to my server. – user1872384 Jan 14 '16 at 14:31

Here's what worked for me, also after trying the xhost + method, NOT via ssh X forwarding:

Add to /etc/gdm/custom.conf


which should cause GDM to start the Xserver without the -nolisten tcp flag in Ubuntu.

Then, sudo service gdm restart

Since 11.10 (Oneiric), it is using LightDM instead of GDM. You'll need to modify /etc/lightdm/lightdm.conf

under [SeatDefaults], add:


then reboot (recommended) or sudo service lightdm restart which may lose your working desktop session.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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