When connecting over ssh to a server with Putty, we can easily export the DISPLAY and run any X-Window application after enable the X11 in the PuTTY configuration. However, if you change to another account any X-Window application will fail as we have to share the MIT-MAGIC Cookies from the first user connected, here is how we can do it.
user1@server3$ echo $DISPLAY localhost:10.0 user1@server3$ xauth list server3/unix:10 MIT-MAGIC-COOKIE-1 6586998224e70480f72d195f55191dc4 server3/unix:11 MIT-MAGIC-COOKIE-1 a9b031f3a222e7525df633a0d674c1b5
Now sudo to another account (i.e. oracle)
user1@server3$ sudo su - oracle Oracle Corporation SunOS 5.10 Generic Patch January 2005
Add the MIT-MAGIC-COOKIEs from the previous account
oracle@server3$ xauth add server3/unix:10 MIT-MAGIC-COOKIE-1 6586998224e70480f72d195f55191dc4 xauth: creating new authority file /u00/app/oracle/.Xauthority oracle@server3$ xauth add server3/unix:11 MIT-MAGIC-COOKIE-1 a9b031f3a222e7525df633a0d674c1b5
Export the DISPLAY to the same host as the previous account.
oracle@server3$ export DISPLAY=localhost:10.0 oracle@server3$ xclock &