I received this problem recently when I logged into root
on a machine.
X11 connection rejected because of wrong authentication
How did this problem happen? Here’s what I did.
ssh -X [email protected]
sudo su
xclock
X11 connection rejected because of wrong authentication
If I open xclock
as a user, then X11 works just fine. As a result, I know that the server and client’s X11 forwarding is working.
A root problem
My .Xauthority
and X11 credentials aren’t being passed over to root
.
ssh [email protected]
sudo su
xauth merge /home/huyle/.Xauthority
xclock
xclock
works, so all I had to do was merge my user’s .Xauthority
to root's
.