Q. I'm trying to login to my remote Ubuntu Linux server from Mac OS X desktop using following command:
ssh -X user@vpn.officeserver.example.com xeyes
But I'm getting an error that read as follows:
X11 connection rejected because of wrong authentication.
How do I fix this error?
A. This error can be caused by various factors. Try following solutions:
Make sure you are not running out of disk space
Run df and make sure you have sufficient disk space:
$ df -H
If you are low on disk space remove unnecessary files from your system.
Make sure ~/.Xauthority owned by you
Run following command to find ownweship:
$ ls -l ~/.Xauthority
Run chown and chmod to fix permission problems
$ chown user:group ~/.Xauthority
$ chmod 0600 ~/.Xauthority
Replace user:group with your actual username and groupname.
Make sure X11 SSHD Forwarding Enabled
Make sure following line exists in sshd_config file:
$ grep X11Forwarding /etc/ssh/sshd_config
Sample output:
X11Forwarding yes
If X11 disabled add following line to sshd_cofing and restart ssh server:
X11Forwarding yes
Make sure X11 client forwarding enabled
Make sure your local ssh_config has following lines:
Host *
ForwardX11 yes
Finally, login to remote server and run X11 as follows from your Mac OS X or Linux desktop system:
ssh -X user@remote.box.example.com xeyes


{ 4 comments… read them below or add one }
In the end of the post you wrote “Finally, login to remote server and run X11 as follows from your Mac OS X or Linux desktop system”. What about Microsoft Windows Os’s? How do i use X11Forwarding in Windows?
Use Putty Windows ssh client, it has support for X11 forwarding. You also need to install Win32-X11 for local display.
There is a programm - Xming, - that allows run some application from Linux server at Windows desktop.
“Xming may be used with implementations of SSH to securely forward X11 sessions from Unix machines. It supports PuTTY and ssh.exe, and comes with a version of PuTTY’s plink.exe.”
http://en.wikipedia.org/wiki/Xming
Vivek, I believe since Mac OS X 10.4, you must use the -Y flag (instead of -X) to enable X11 forwarding. If I use -X on 10.4 or 10.5, I get the authentication error, but -Y always works.
Not sure why Apple broke convention here, but I think this is the fix you are looking for.