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:
(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.
bydave, 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).