Fix for “ssh -Y” on OS X

On OS X, attempting to use “ssh -Y” to another Mac can fail with this sort of error:

Warning: No xauth data; using fake authentication data for X11 forwarding.X11 forwarding request failed on channel 0

This is due to an inadequate configuration. The fix is to add these lines to these two files on both Macs:

/etc/sshd_config
  • X11Forwarding yes
  • XauthLocation /opt/X11/bin/xauth
/etc/ssh_config
  • XauthLocation /opt/X11/bin/xauth

From Divan Visagie with some slight modifications.