Monday, October 22, 2012

PuTTY X11 proxy: wrong authorisation protocol attempted Error: Can't open display: localhost:X.Y

This site helped with the solution:

http://froebe.net/blog/2008/11/14/getting-xlib-putty-x11-proxy-wrong-authentication-protocol-attempted-i-have-the-answer/

This site helped with configuring Xming:

http://www.math.umn.edu/systems_guide/putty_xwin32.html

Here's what I did (this assumes you have Xming installed and configured):

After installing Xming on a Windows box, I installed PuTTY.  I configured my PuTTY session for X11 forwarding as follows:

1. Start PuTTY

2. Enter a name or IP address in the Host Name (or IP address) box and for Connection type, select SSH

3. Save the session

4. In the Category section, expand Connection then SSH, then X11

5. On the Options controlling SSH X11 forwarding screen, check Enable X11 forwarding and MIT-Magic-Cookie-1

6. From the Category section on the left, click Session and then click Save in the Basic options for Your PuTTY session section

7. Start an Xming session, followed by an SSH session from PuTTY

8. From your newly opened SSH session, type xclock

9. An xwindow clock will appear on your Windows server

10. Now su - oracle

11. Attempt the same by typing xclock and you'll see an error such as this:
PuTTY X11 proxy: wrong authorisation protocol attempted Error: Can't open display: localhost:11.0

12. Open another PuTTY session and type the following:
# xauth list
localhost.localdomain/unix:0  MIT-MAGIC-COOKIE-1  1425043ba52e4f50f597c83d434baf82

13. In your oracle session, type the following:
$ xauth add localhost:0  MIT-MAGIC-COOKIE-1  1425043ba52e4f50f597c83d434baf82

14. Export your display to your Windows box:
$ export DISPLAY=192.168.10.120
$ export DISPLAY=localhost:10.0
Thanks for the correction to Anonymous posted January 25, 2013.

15. Run xclock, and you should see the clock on your Windows box

7 comments:

  1. I think your step 14 is bypassing SSH and directing X to your Windows comp's port 6000.

    When using SSH, the X Windows are supposed to redirect while DISPLAY is set to localhost:10.0

    ReplyDelete
  2. Advanced Usage

    The most important connection that is made is from the user's client machine to the first remote host. One may "nest" X11 forwarding by using the ssh -XY command to jump to other remote hosts.

    For example:

    1. on client PC (*nix or Windows), ssh to remotehost1

    2. on remotehost1 (presumably a *nix machine), ssh -XY to remotehost2

    3. on remotehost2 (presumably a *nix machine), ssh -XY to remotehost3

    ...

    8. on remotehost8 (presumably a *nix machine), ssh -XY to remotehost9

    9. on remotehost9, running an X11 application like xterm should propagate the remote window back to the initial client PC through all of the additional remote connects.


    Nickwe

    ReplyDelete
    Replies
    1. Try: Set in /etc/ssh/sshd_config "AddressFamily inet" instead of "any"

      Oz

      Delete
  3. I tired the same steps and able to view xclock.
    But i guess this is not permanent solution.
    we have to perform same steps every time we log in to putty.
    Is there any way to make it persistent?

    ReplyDelete
    Replies
    1. Hi,

      You can save your putty settings. You should set the following settings for your putty session:
      Connection -> SSH -> X11
      Check Enable X11 forwarding
      X display location (usually set to localhost:0.0)
      Check MIT-Magic-Cookie-1

      Save these.

      When you log in using this saved session you should be able to type xclock and not have to do anything else.

      Delete
  4. You absolutely bailed me out - thank you!

    The only addition I have to make is when I tried to use xauth add, it complained about a non-existent .Xauthority file in /home/oracle. I copied that manually from my home dir and it worked!

    Thanks

    ReplyDelete
  5. I hit this problem when I had to "sudo su" before running a graphical installer. This solution worked perfectly. Thanks!

    ReplyDelete