1823426 Members
2597 Online
109655 Solutions
New Discussion

xauth

 
SOLVED
Go to solution
YLTan
Frequent Advisor

xauth

I have sshd in place with X11 forwarding enable on both client and server(sshd_config)

When i do su to other users, or sudo , the xterm reply with error message;

Error: Can't open display: 11.22.5.29:10.0
Error: Couldn't find per display information

I read some previous posting that I need to use xauth to add MAGIC-COOKIE to my session.

How do i use xauth to add this MAGIC-COOKIE?

i don't understand what man pages says.
tyl
1 REPLY 1
Alex Glennie
Honored Contributor
Solution

Re: xauth

Getting "su newuser" to work through ssh

The newly assigned MIT-MAGIC-COOKIE must be provided to newuser. This feature of ssh can not be by-passed by using the "xhost" command.

Extracting and passing the MIT-MAGIC-COOKIE can be done by using the follow sequence of commands:

olduser@remote$ xauth nextract - $DISPLAY | xauth -f /tmp/newuser.xauth nmerge -
olduser@remote$ echo $DISPLAY > /tmp/newuser.display
olduser@remote$ chmod 700 /tmp/newuser.xauth /tmp/newuser.display
olduser@remote$ chown newuser /tmp/newuser.xauth /tmp/newuser.display
olduser@remote$ su - newuser
newuser@remote$ export XAUTHORITY=/tmp/newuser.xauth
newuser@remote$ export DISPLAY=$(cat /tmp/newuser.display)
newuser@remote$ rm /tmp/newuser.display