setting X display using Putty and Xming

setting X display using Putty and Xming on Windows XP.

install putty:
http://www.chiark.greenend.org.uk/~sgtatham/putty/
create new session.
make sure SSH -> X11 ->
Enable X11 forwarding is checked
X display location have localhost:0 in it
save the connection.

install xming
http://sourceforge.net/projects/xming/
start xming with XLaunch.exe (keep all defaults)

open ssh session with putty

make sure following in not commented, if it is then you (or root if you are not root) have to uncomment it.

/etc/ssh$ grep X11Forwarding sshd_config
X11Forwarding yes

run following

$ xclock

you should see a clock window poped up on your PC

to run in background run

$ xclock &

there are many gui applications, that you can run
I found mozilla on sparc here–

/usr/sfw/bin/mozilla

later on I find out similar x display product
http://sourceforge.net/projects/vcxsrv/
have more native to windows ui then xming and might be faster, ites same as xming except compiled with visual c++.

and if you are doing sudo and trying to run X
1- use putty to login into the server as your user (It didnt work when I logged in server ‘a’ from putty then from server a I ssh -X in server ‘b’)
2- sodu – su otheruser

ssh jason@remote-server -X
jason $ echo $DISPLAY
localhost:10.0
jason $ su – oracle
oracle‘s Password:
oracle $ xterm
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

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

make sure your $DISPLAY is same user you logged in from putty, if not make it same
$export DISPLAY=localhost:10.0

here is what you do ( /usr/openwin/bin//xauth on solaris)

jason $ xauth list
aspc2o1/unix:10 MIT-MAGIC-COOKIE-1 bc334c66cfec3c5c3d5b0efc4ee9d3ad

Next, sudo/su to the other account and add the authorization key.
jason $ su – oracle
oracle $ xauth add aspc2o1/unix:10 MIT-MAGIC-COOKIE-1 bc334c66cfec3c5c3d5b0efc4ee9d3ad

and then $JAVA_HOME/bin/jconsole (or ui app you want to run)