Let's face it: Putty and Xming are the only reasons Windows is slightly tolerable in this day and age... When you cannot have a UN*X box on your desk, these two are life-savers.
But... once upon a time, you may find yourself trying to start a graphical application through X11, on a distant machine accessed through SSH.
Only to find yourself staring at the following message (or something quite like it):
root@galactus# oclock & [1] 26402 Xlib: connection to "localhost:11.0" refused by server Xlib: PuTTY X11 proxy: wrong authentication protocol attempted Error: Can't open display: localhost:11.0 [1]+ Exit 1 oclock
Ooops! What's wrong?
You have done an su
or a sudo
to a different user, without copying the correct MIT-MAGIC-COOKIE
authentication. In the example shown above, the user root
is trying to run the oclock
X11 clock (a very nice test before running more important applications).
You should list these cookies by entering the following, under the account you used to login:
$ xauth list 10.254.212.13:0 MIT-MAGIC-COOKIE-1 8783b78982a4be8c99a88d99a19495ae 10.200.200.139:0 MIT-MAGIC-COOKIE-1 a59dabaf8cb79b999db399a4be97849a galactus/unix:10 MIT-MAGIC-COOKIE-1 4ea88bc8281ee1e7f6b296728e99c4b7 galactus/unix:11 MIT-MAGIC-COOKIE-1 fefb4342e24c0bdff69c4e313614912e galactus/unix:12 MIT-MAGIC-COOKIE-1 b36a53f1b53dd605ec234242b6e8a1b0
Here, the user used to login remotely into the machine 'Galactus' has 5 magic cookies. These should be copied into the root account.
Therefore, as the user (in this case, root
) trying to run the X11 application, add the cookies by hand:
root@galactus# xauth add 10.254.212.13:0 MIT-MAGIC-COOKIE-1 8783b78982a4be8c99a88d99a19495ae root@galactus# xauth add 10.200.200.139:0 MIT-MAGIC-COOKIE-1 a59dabaf8cb79b999db399a4be97849a root@galactus# xauth add galactus/unix:10 MIT-MAGIC-COOKIE-1 4ea88bc8281ee1e7f6b296728e99c4b7 root@galactus# xauth add galactus/unix:11 MIT-MAGIC-COOKIE-1 fefb4342e24c0bdff69c4e313614912e root@galactus# xauth add galactus/unix:12 MIT-MAGIC-COOKIE-1 b36a53f1b53dd605ec234242b6e8a1b0
Check that the Putty X11 Forwarding function is correctly activated, as well as your DISPLAY
variable:
root@galactus# env | grep -i display DISPLAY=localhost:11.0
... And you should be in business!
Everything on that page comes from the following link, which has been greatly appreciated!