X11 forwarding problems

If you setup X11 forwarding in putty. Then after SSH to server and user change via su then error could ocurr.

Xlib: connection to “localhost:10.0″ refused by server
Xlib: PuTTY X11 proxy: wrong authentication protocol attempted xterm Xt error: Can’t open display: localhost:10.0

To solve, back to oryginal user:

issue:

>xauth list
localhost:10  MIT-MAGIC-COOKIE-1  b31fa494b952390070d409890a3
14cfb

then on new user:

> xauth add server/unix:10  MIT-MAGIC-COOKIE-1  b31fa494b952390070d409890a314cfb