Wednesday 6 October 2010

Enabling X/X11 tunnelling/forwarding on OSX

It seems that X11 forwarding is not enabled as default on OSX so if you connect to machine using ssh and then try to run an X command (e.g. /usr/X11R6/xterm) it fails with: "unable to open display"

To enable X11 forwarding on your_osx_host machine edit /etc/sshd_config e.g.
sudo vi /etc/sshd_config
And add the following line:
X11Forwarding yes
Then restart the sshd service:
sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd 
or
sudo service ssh restart

Then from your remote machine logout and log back in and you should be able to use forwarded X11 apps - you may need to enable [trusted] X11 forwarding on your client as well e.g:
ssh -XY your_osx_host

No comments:

Post a Comment