Tuesday, November 15, 2011

ssh x11 forward remote display

if you use ssh x11 forwording , you don't need export DISPLAY=remoteserver:0.0.

if you get below error:
Xlib: connection to "localhost:13.0" refused by server
Xlib: PuTTY X11 proxy: MIT-MAGIC-COOKIE-1 data did not match
the cause is the auth line in .Xauthority file is wrong or missing.

if you get below error:
PuTTY X11 proxy: wrong authentication protocol attemptedError: Can't open display: localhost:12.0
the Cause is that you sudo su to the current user.

1. xauth list -- find out want auth line in the file
local/unix:1 MIT-MAGIC-COOKIE-1 8afedf4b9d02e29fff549f534fb8e495
local/unix:13 MIT-MAGIC-COOKIE-1 29230aecd972e2f64dd0973be473f8c2
local/unix:11 MIT-MAGIC-COOKIE-1 c22a518b8ae65a8e2411dda2d561e9ec
local/unix:12 MIT-MAGIC-COOKIE-1 4a3e6c97e72a98a7d5b934127e7c0559
local/unix:10 MIT-MAGIC-COOKIE-1 26ea6ffc0f2704e6df399caff0fccb26

2. xauth remove local/unix:13

3. exit current su user

4. xauth list -- find out initial user login x11 auth line
local/unix:13 MIT-MAGIC-COOKIE-1 4075c2721e69295e62187bb9c8b04b6b

5. su back to user like oracle

6. xauth add local/unix:13 MIT-MAGIC-COOKIE-1 4075c2721e69295e62187bb9c8b04b6b

7. run xclock -- it should appear in your laptop or desktop.
ATTN: if not, check if your laptop or desktop has X-mananger like xing running


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

1 comment:

  1. To make this happen automatically, you can add a line to /etc/sudoers like so:

    Defaults env_keep += HOME

    See http://www.gratisoft.us/bugzilla/show_bug.cgi?id=522

    ReplyDelete