I don't have access to root account to do any of the above, so here is a work around that I used.
First, ssh to your account like you normally do and test everything is working.
ssh -Y <you>@<your_server>
I usually just fire up an XTerm to ensure I have connectivity. If all good, copy .XAuthority file that is in <you>
home directory and put it in a public directory.
cp ~/.Xauthority /tmp/tempXAuth
Make sure you chmod 777 on that file in the public directory so that the sudo account can use it in the later step.
chmod 777 /tmp/tempXAuth
now sudo to the user you need to do work as
sudo su - <other_user>
once you are <other_user>
, back up the existing .Xauthority and then copy the "good" one over.
cp ~/.Xauthority ~/.Xauthority.bak
cp /tmp/tempXAuth ~/.Xauthority
you should be able to run any X programs and have them authenticate with your current XServer session.
1this is more due to X permissions than X forwarding -- the user you've logged into with SSH has permission to connect to the X display, but when you switch users with 'sudo' the user you're switching to doesn't have those permissions. – quack quixote – 2010-04-15T00:54:32.400
There should be a work around though... I have root access, I should be able to run an X11-forwarded app as a different user. How do I get it to work? – Jarvin – 2010-04-15T13:41:44.483