X11 connection rejected because of wrong authentication

I am aware this has been mentioned before, however I am experiencing this issue at the moment. I get this error message every few seconds (random, not a repeating interval) in one of my logins, while others are fine. This issue is also observed by nearly all of our lab members. This happens sporadically, sometimes it will be fine for days, and once in a while one of my ssh logins will continuously spew out this error message, while other simultaneously active logins will be fine. This happens when connected with -X or -Y and authenticated via a key or password. Also seems to be OS independent since I have observed this using ssh on Linux (Ubuntu 20.04), Mac OS (big sur), and Windows 10.
Attached is a screenshot.

Thanks in advance,

Hi there,

Right, for the next time please follow-up the discussion in the original thread (cf. X11 connection rejected - #5 by Halit.Ongen ).

Does “in one of my logins” mean “I have distinct SSH connections, only one of them shows the problem”?

If so, this could be a problem with the “system” (D-Bus, mainly) variables not shared between sessions.

Nevertheless, your ~/.bashrc is quite complex, could you try to reproduce the error with a minimal one (e.g. /etc/skel/.bashrc )?

Moreover, have you tried sharing a single SSH connection from the same IP via the -o ControlMaster=auto option?

Thx, bye,

I have met the same problem from time to time. It is difficult to reproduce because, as Halit said, it appears randomly.

My .bashrc is quite simple: only sourcing /etc/bashrc and extending the bash history size.

It may be, but I’m not sure, that this only happens when I’m using the X-forwarding options on my SSH connexion: ssh -XY baobab . However it appears rarely, given how often I use these two options.

Hi there,

Good to know, thank you!

Another simple question for your case: does the problem happen on a unige and new SSH connection (i.e. no other previous connections are still running) or only when multiple connections are used?

FYI, I could not reproduce the problem with my Debian 10.8/buster, with multiple non-shared (thus ssh -o ControlMaster=no ) connections (2x with X-forwarding and 2x without).

The problem must arrive on a X-forwarded SSH session only, otherwise the error message should be “cannot open display”.

NB, options -X et -Y are “mutually” exclusive, i.e. -Y supersedes -X. You should simply use -Y as described in the UNIGE HPC documentation (cf. hpc:access_the_hpc_clusters [eResearch Doc] ).

Please note that if you can close all your SSH connections, you can also try to delete the current ~/.Xauthority file to start again from scratch.

Thx, bye,


Thank you very much for your help and investigation. My current solution to the issue is to close the ssh connection with the error message and open up a new connection.

The general problem is that this is nigh on impossile to reproduce. It happens randomly so I am not suprised you fail to reproduce the error.

To be exact, since I don’t know what you mean by distict, these are separate terminal windows, which have separately logged in with ssh -Y, from the same client machine, with the same ips.

Unfortunately, I don’t exactly know/understand what this means, so I cannot answer the question.

I am fairly certain that this has nothing to do with bashrc, as David and others in our lab have experienced this problem with “empty” bashrcs. Also, this used to happen to me when my bashrc was practically blank.

I will try this option, but it may be weeks before I can confirm this has an effect, since the issue is random.

This happens to me when a single ssh connection is active as well, i.e. the error is not only triggered with multiple connections. I have observed the problem in connections from multiple networks, including unige, and multiple OSes.

I am not 100% sure, but I believe I have tried this in the past and it did not resolve the issue.



This just happened now, although no terminal flooding (only one line).

I have one single terminal open, so only one SSH connection, running from home (not from UniGE network). The connection had been active for 1-2 hours when the message arrived. It is not my first SSH connection of the day, however, but at no time today did I have two parallel SSH.

I’m connecting from Ubuntu 18.04.05 if that is relevant.

Hi there,

I got the error, but on Yggdrasil and not Baobab, simply doing:

$ ssh -Y login1.yggdrasil.hpc.unige.ch
[capello@login1 ~]$ salloc -n 1 -c 1 --x11 --partition shared-bigmem --time=0-00:15:00 srun -n 1 -N 1 --pty $SHELL

NB , the very same command did not give me any error on Baobab, maybe simply by chance.

xauth stuffs are OK, thus I need to investigate more, thanks for your patience.

Thx, bye,