Ssh – annoying message “X11 connection rejected because of wrong authentication” while there is no problem at all

linuxsshx11

I'm having an annoying problem.

When I'm logged in to a specific host via SSH, the message

X11 connection rejected because of wrong authentication.

occurs three times seemingly random about once a minute. I have no idea where it comes from.

Actually, there is not even any slight problem with X11-forwarding, it works like a charm. But this message keeps appearing and it's driving me crazy.

Does anyone have an idea how to get rid of it?

I'm facing the problem no matter where I'm coming from, it happens from my Gnome-Desktop and also from a Windows-system using PuTTY, MobaXterm, Cygwin, whatever.


After twiddling some more I found the cause to be a monitoring-agent (check_mk). This checks some runtime-parameters of running tasks, the message appeared every time, when this agent was triggered from the monitoring-system, exactly when PostgreSQL-status is checked. It seems this process tries to open an X11-connection but fails. The message is then spit over into my terminal-session as it tried to use my forwarded X11-session.

Is there a way to disable this message at all?

Best Answer

Make sure you are not running out of disk space

Run df and make sure you have sufficient disk space, if you are low on disk space remove unnecessary files from your system:

$ df -h

If there are quotas imposed on the file systems, check that you did not exceed your quota:

$ quota -s

Make sure ~/.Xauthority owned by you

Run following command to find ownweship:

$ ls -l ~/.Xauthority

Run chown and chmod to fix permission problems [replace user:group with your actual username and groupname]:

$ chown user:group ~/.Xauthority
$ chmod 0600 ~/.Xauthority

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-host.com

Credit for information belongs here: http://www.cyberciti.biz/faq/x11-connection-rejected-because-of-wrong-authentication/

Hope that helps.

Related Question