I can SSH into a remote Linux box from my macbook, when I am in an Ubuntu Virtual Machine on that macbook - but not from OSX. I seek guidance on how to get OSX to work with X11 forwarding and suspect this is an OSX Mavericks problem. It used to work on Mountain Lion before I upgraded, so I think I missed a step.

Note that this is not X11/XQuartz won't auto-launch after upgrading to OS X Mavericks? as I did a format and clean install of Mavericks

X11 SERVER - Ubuntu Desktop

# This is the /etc/ssh/sshd_config file, trimmed down

# Relevant lines:
X11Forwarding yes
X11UseLocalhost yes
X11DisplayOffset 10

# Maybe relevant:
RSAAuthentication no
PubkeyAuthentication yes
AuthorizedKeysFile  %h/.ssh/authorized_keys
PasswordAuthentication yes # I didn't want to copy the rsa key into ubuntu VM so I accessed the server by password authentication rather than by rsa key.
TCPKeepAlive yes

I can ssh into this machine no problems.

X11 CLIENT - OSX Mavericks (not working)

I installed XQuartz 2.7.5, not sure which version I had on OSX Mountain Lion.

# edited /etc/ssh_config to prevent timeout issues

ForwardX11Timeout 596h

In the .ssh/config file I have

Host remotegossamer
  User joe
  port 22
  Hostname # (edited.. I use no-ip as I have a dynamic ip)
  ForwardX11 yes
  ForwardX11Trusted yes # This gets rid of the warning: "Warning: untrusted X11 forwarding setup failed: xauth key data not generated"

When I ssh in I get a warning

> ssh remotegossamer
Warning: No xauth data; using fake authentication data for X11 forwarding.
Welcome to Ubuntu 13.10 (GNU/Linux 3.11.0-15-generic x86_64)

When I attempt to open an X11 window it fails

joe@gossammer:~$ firefox&
[1] 12195
joe@gossammer:~$ connect port 6010: Connection refused

(process:12195): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
connect port 6010: Connection refused
connect port 6010: Connection refused
Error: cannot open display: localhost:10.0
[1]+  Exit 1                  firefox

The Glib-CRITICAL is a firefox bug which is present for both ubuntu and osx clients, its the server's problem, and can be ignored.

The result of echo $DISPLAY is either localhost:10.0 or localhost:11.0 depending on whether I ssh in with the current machine first or second. Disconnecting both machines and sshing in in the reverse order has no effect; ubuntu client succeeds with 10 and 11, OSX fails with both.

I read up on this and port 6010 is correct as it starts at port 6000 and counts up in increments of 10, as mentioned in the server's sshd_config.

So I am baffled as to why OSX is not connecting...

I should note that when I used to ssh in from Mountain Lion, the XQuartz app would start - now it does not

X11 CLIENT - Ubuntu Desktop (In virtual machine on OSX Mavericks)

To configure the ubuntu VM to ssh into the server:

# I edited the /etc/ssh/ssh_config to have:
Host *
    ForwardAgent yes
    ForwardX11 yes
    ForwardX11Trusted yes

Then I ssh'd in with:

ssh -Y joe@

and got no warnings. Then, I did:

> firefox&

And it opened in X11, great, so its a problem with OSX / the way I have set up OSX

And so

Did I miss something with setting up X11 on OSX Mavericks?

1 Answer 1


Try the following command (once you're logged in on OS X):

export XAUTHORITY=/home/your_name/.Xauthority

and then try some innocuous X app, like xeyes. If it works, you can put that statement in your .bashrc file.

  • Down to only one error! Progress! Error: Can't open display:
    – xxjjnn
    Feb 10, 2014 at 12:18
  • @ClothSword On the server side, do you have, in /etc/ssh/sshd_config, this line: X11UseLocalhost yes ? It should be commented out. Feb 10, 2014 at 12:34
  • No that causes more errors, it gives connect port 6010: Connection refused connect port 6010: Connection refused connect port 6010: Connection refused Error: cannot open display: localhost:10.0 note that it was working fine with Ubuntu client so I think its a problem with the mac setup. Hmm, setting it back and these new errors remain...
    – xxjjnn
    Feb 10, 2014 at 14:46

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.