* Prerequisite
The secure shell daemon (sshd) in the Unix box should be set up to support X11 forwarding, to enable this
1. Login as root
2. Edit /etc/ssh/sshd_config adding next line
X11Forwarding yes
(In HP-UX, sshd_config is in /opt/ssh/etc/)
3. Restart sshd
in AIX: /etc/rc.d/rc2.d/Ssshd {stop|start} OR stopsrc -s sshd; startsrc -s sshd
in Linux: /etc/init.d/sshd {stop|start}
in Solaris: svcadm refresh ssh
in HP-UX: /sbin/init.d/secsh {stop|start}
* Case 1: my PC with cygwin directly connects to remote Unix box (my PC <----> Unix)
1. Start cygwin XWin Server using Windows menu or using startxwin command in cygwin command window.
2. Set up secure shell tunnel by running next command in a cygwin command window.
cygwin$ ssh -X -Y -C user@remote_unix_host
3. In the shell session opened in above step, make sure DISPLAY environment variable is set and run X comands like xterm, xclock, ...
Sample session:
cygwin_in_WinXP$ ssh -X -Y -C johndoe@debian
johndoe@debian's password: XXX
johndoe@debian ~$ echo $DISPLAY
localhost:11.0
johndoe@debian ~$ xterm &
[1] 1234
johndoe@debian ~$
xterm should pop up in my Windows XP box.
* Case 2: my PC with cygwin cannot connect to the remote Unix box as it's behind firewall having private IP address 192.nnn.nnn.nnn. (my PC <----> SSH relay host <----> Unix)
Let's call ssh relay host ssh_box and target Unix host xwin_box.
0. Add next lines in your Windows hosts file (C:\Windows\System32\drivers\etc\hosts).
127.0.0.1 locahost xwin_box
10.10.1.10 ssh_box # public IP address, so no problem for direct connection
Also make sure xwin_box is registered in the /etc/hosts file of ssh_box too.
(In fact, aliasing xwin_box is optional as localhost can be used in step 3 below)
1. Start cygwin XWin Server using Windows menu or using startxwin command in cygwin command window.
2. Set up secure shell tunnel by running next command in a cygwin command window.
cygwin$ ssh -C -L 2222:xwin_box:22 user@ssh_box
3. Run next command in another cygwin command window.
cygwin$ ssh -X -Y -C -p 2222 xuser@xwin_box
or
cygwin$ ssh -X -Y -p 2222 xuser@localhost
4. In the shell session opened in above step 3, make sure DISPLAY environment variable is set and run X comands like xterm, xclock, ...
2010-12-17
Subscribe to:
Posts (Atom)