Re: X11 Connection rejected because of wrong authentication. (1954 Views)
Reply
Frequent Advisor
Narendra Thapa
Posts: 61
Registered: ‎05-29-2007
Message 1 of 3 (1,954 Views)

X11 Connection rejected because of wrong authentication.

Hi All,

I am getting this message when I try to export DSIPLAY with non root user.

I am able to run xclock with root user but when I try the same with non-root user I am getting this particular error.


I am using a linux machine to export Display.
I have HP-UX 11.31 Sept 09.
X11 Connection rejected because of wrong authentication.

# ssh -X user@abc.com
# xclock
X connection to localhost:10:0 broken (explict kill or server shutdown)


Note; I am able to run xclock (display) with root user.
"Study as if you were going to live forever; live as if you were going to die tomorrow."
Please use plain text.
Trusted Contributor
mvpel
Posts: 271
Registered: ‎01-11-2009
Message 2 of 3 (1,954 Views)

Re: X11 Connection rejected because of wrong authentication.

Your example doesn't match up with your description of the error message. Which is it, an explicit kill or server shutdown or "wrong authentication?"

The explicit kill error usually means that your X server is not running on the local end of your SSH tunnel. Are you connecting to the system from a Windows machine? You need to start Xming or Exceed before you use an X application via your SSH tunnel.

If you log in as a user, then su to root, your root account will not have access to your display unless you copy the xauth magic cookie into the root .Xauthority file, or set root's XAUTHORITY env variable to your login user .Xauthority file (assuming it's readable by root.)

% whoami
joeuser
% echo $DISPLAY
:0.0
% su root
# export XAUTHORITY=/home/joeuser/.Xauthority
# xclock
*clock appears*

The .Xauthority file is managed by "xauth" - each display has a secret random-number "cookie" which is required in order to allow use of that display.

If root can't read the user's .Xauthority file, such as on an NFS mount, you need to add the cookie to root's own .Xauthority:

% whoami
joeuser
% echo $DISPLAY
localhost:10.0
% xauth list | tail -1
hostname/unix:10 MIT-MAGIC-COOKIE-1 dc5897c0f1931a0df12a7ee36c21f000
% su root
# export XAUTHORITY=/.Xauthority
# xauth add localhost:10.0 dc5897c0f1931a0df12a7ee36c21f000
# xclock
*clock appears*

You can also use the "xhost +" host-based authentication method, but that's considerably less secure than the magic cookies, not that that's saying much.
Please use plain text.
Honored Contributor
Johnson Punniyalingam
Posts: 2,246
Registered: ‎09-22-2008
Message 3 of 3 (1,954 Views)

Re: X11 Connection rejected because of wrong authentication.

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1127289

http://www.cyberciti.biz/faq/x11-connection-rejected-because-of-wrong-authentication/

Hope above links, should help to resolve your problem.

if satisfied with the answers, assigning points :)
Problems are common to all, but attitude makes the difference
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation