Q. I’m trying to login to my remote Ubuntu Linux server from Mac OS X desktop using following command:
ssh -X firstname.lastname@example.org 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
If X11 disabled add following line to sshd_cofing and restart ssh server:
Make sure X11 client forwarding enabled
Make sure your local ssh_config has following lines:
Finally, login to remote server and run X11 as follows from your Mac OS X or Linux desktop system:
ssh -X email@example.com xeyes