News

News->Solar1 News Flash->Techie helpful hints and tip #3   
Techie helpful hints and tip #3

Getting X11 forwarding working after running sudo

X authentication is based on cookies -- secret little pieces of random data that only you and the X server know... So, you need to let the other user in on what your cookie is. One way to do this is as follows:

Before you issue the su (but after having ssh'ed into the remote system), request the cookie for the current DISPLAY that's connecting to your X server:

   $ xauth list $DISPLAY 

You'll get something like

   somehost.somedomain:10  MIT-MAGIC-COOKIE-1 4d22408a71a55b41ccd1657d377923ae 

Then, after having done su, tell the new user what the cookie is:

   $ xauth add somehost.somedomain:10  MIT-MAGIC-COOKIE-1 4d22408a71a55b41ccd1657d377923ae 

(just cut'n-paste the output of the above 'xauth list' onto 'xauth add') That's it. Now, you _should_ be able to start any X application.




by dave, Tuesday, 19 December 2006 18:42, Comments(1)
Comments
buchanmilne
06 Jun 2008
1. For su, rather just configure su's pam stack correctly, adding pam_xuath

2. For sudo (where I haven't managed to get pam_xauth to work right), you can also use 'xauth merge `getent passwd $SUDO_USER|awk -F: '{print $}'`/.Xauthority' (if the target user has read access to the source user's home directory).


MKPNews ©2003-2008 mkportal.it
 


MKPortal C1.2.1 ©2003-2008 mkportal.it
Page generated in 0.01312 seconds with 12 queries