[Solved] putty+x11:How do I pass X11 display rights to "su"?

I can log into a unix system with Putty. I've set the "X11 forwarding" checkbox, and I've verified that I can display an X11 window back on my laptop. What I need to be able to do is "su" to another uid after logging in and then run something which display a window back on my laptop, with the permissions of that su-ed id. That isn't working. I imagine this has something to do with ssh, but I can't figure out the EXACT steps I need to go through to get this to work.

Try the following:

  1. Log in to the system, issue the following commands and save their output for further reference:
echo "$DISPLAY"
xauth list

You will see something similar to this:

% echo $DISPLAY
localhost:10.0
% xauth list
ubuntu/unix:12  MIT-MAGIC-COOKIE-1  9e7f2b822e5c1cdd96d048adfb870519
ubuntu/unix:11  MIT-MAGIC-COOKIE-1  1eaf535afee8b2de2f0ab9bcab7ef149
ubuntu/unix:10  MIT-MAGIC-COOKIE-1  3bd9602df5fe354c19e39f211ee4668b

Note the value after the semicolon in the DISPLAY value (10 in this case, in red),
note that the last entry is the cookie you're interested in (also in red).
2. Switch the user (su ...), and run the following commands:

% su -
Password:
~# export DISPLAY=localhost:10.0 # this is the previously saved DISPLAY value
~# xauth add ubuntu/unix:10  MIT-MAGIC-COOKIE-1  3bd9602df5fe354c19e39f211ee4668b # this is the last entry from xauth list output

After this your X session should work.

Outstanding. That fired my long-inactive X11 neurons. It worked fine.