Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my local machine, I run:

ssh -X me@remotemachine.com

(For completeness, I have also tested all of the following using -Y with identical results).

As expected, this accesses remotemachine.com fine, and all appears well. If I then attempt to run xcalc however, I get:

 connect /tmp/.X11-unix/X0: No such file or directory
 Error: Can't open display: localhost:10.0


$ ls -la /tmp/.X11-unix/
total 36
drwxrwxrwt 2 root root  4096 2012-11-23 09:29 .
drwxrwxrwt 8 root root 32768 2012-11-29 08:22 ..
srwxrwxrwx 1 root root     0 2012-11-23 09:29 X0

So not only does /tmp/.X11-unix/X0 exist, it has universal r/w/x permissions!

I've previously used x-forwarding without issue, though not in some time...

uname -a on the server for reference:

Linux machinename 2.6.32-25-generic #45-Ubuntu SMP Sat Oct 16 19:52:42 UTC 2010 x86_64 GNU/Linux

Been searching around on the web for a couple hours now without success. Other mentions of the same problem, but no solutions.

share|improve this question
Note that it's the file on the local machine that you need to check here, not the remote one. I would use strace -fo /tmp/trace ssh.... to check that it does try to connect that Unix domain socket. – Stéphane Chazelas Nov 29 '12 at 14:27
Ah! That could be it. Strangely, my local machine does not have a /tmp/.X11-unix/ directory though. – John Doucette Nov 29 '12 at 14:46
up vote 11 down vote accepted

If you have a X server running and the DISPLAY environment variable is set to :0, that tells applications to connect to the X server using a unix domain socket which is generally to be found on Linux in /tmp/.X11-unix/X0 (though see below about the abstract namespace on recent Linux).

When you ssh to machine remotemachine, sshd on remotemachine sets DISPLAY to localhost:10 (for instance), which this time means that X connections are do be done over TCP to port 6010 of machine localhost. sshd on remotemachine listens for connections on there and forwards any incoming connection to the ssh client. The ssh client then tries to connect to /tmp/.X11-unix/X0 to contact your X server.

Now, maybe you don't have a X server running (are you on Mac?) or maybe the unix domain socket is not to be found in /tmp/.X11-unix which would mean ssh hasn't been configured properly at compile time.

To figure out what the proper path is for the unix socket, you could try a strace -e connect xlogo (or the equivalent on your system) on your local machine to see what a normal X application does.

netstat -x | grep X may also give a clue.

For the record, on a Linux Debian wheezy machine here, Xorg listens on both /tmp/.X11-unix/X0 in the filesystem and /tmp/.X11-unix/X0 on the abstract namespace (generally written @/tmp/.X11-unix/X0). From strace, X11 applications seem to now use that abstract namespace by default, which explains why those still work if /tmp/.X11-unix is removed, while ssh doesn't use that abstract namespace.

share|improve this answer
Or check lsof -p <PID of your local X server> where you should be able to find the /some/thing/Xn file, the n being your DISPLAY number. – peterph Nov 29 '12 at 14:58
Thanks, this was quite helpful. Somehow my /tmp/.X11-unix/X0 file was removed, although there was still an X server running. A quick reboot seems to have resolved the problem. Possibly caused by some updates I did a while back. – John Doucette Nov 29 '12 at 15:00
Changing the DISPLAY variable from ":0.0" to "localhost:0.0" seems to have done the trick for me, at least connecting from Cygwin to Linux. – m0j0 Aug 4 '15 at 23:28

I had the same problem with Cygwin and Xming, connecting to a remote Linux server.

My $DISPLAY variable was simply ":0.0" in Cygwin, and although that works locally, it didn't work with the remote ssh command.

Changing the variable to "localhost:0.0" fixed the issue.

export DISPLAY=localhost:0.0

Once I did that, my command worked:

ssh -Yf user@host gvim somefile.c
share|improve this answer

I just had the same problem. The confusing thing is that you get the no-such-file error on the remote machine, but actually this file is missing on the local (display) machine.

Just to see what would happen, I manually created the missing file (fifo, actually), on the display machine, like this:

mkfifo /tmp/.X11-unix/X0

Then ssh'ed into remote machine again, and lo and behold, X11 connected fine.

I don't know if this is relevant or not, but my display machine is not Linux, it's Windows with cygwin and VcXsrv. (The remote machine is Linux)

share|improve this answer
/tmp/.X11-unix/X0 is a unix domain socket, not a FIFO – Samveen Jun 5 '15 at 5:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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