Creating ssh tunnel from Windows and Solaris

Wednesday, October 21, 2009

I was trying to find the easiest way to create an ssh tunnel from Windows to a Solaris box via an authenticated gateway server to access a secure web page in the target server, though there are many ways to do that, I found that the easiest one is to use command line.

Assume that a Host A wants to tunnel HTTPS traffic to host C via an authenticated Gateway server host C (where you have an account), then the following steps would be helpful.

Lets assume that the target's server IP address is 10.2.152.2 and the gateway IP is 10.2.152.1, and you want to access https://10.2.152.2:9443 from the source system.

Creating ssh tunnel from Solaris:

bash-3.00$ ssh -L 9443:10.2.152.2:9443 -X username@10.2.152.1
Password: ********
Last login: Wed Oct 21 20:03:26 2009 from system25
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
bash-3.00$

Now from a firefox browser if you type https://localhost:9443, the HTTPS traffic will be tunneled to https://10.2.152.2:9443.

Creating ssh tunnel from Windows:

Even though there are many ways to do it from Windows using putty, if you are an UNIX user who love command line, its almost similar to that of the above procedure.

1. Download putty (and cd to the directory where you cn find putty.exe).

2. C:\putty_install> putty -L 9443:10.2.152.2:9443 -X username@10.2.152.1
(A putty window opens)
Using username "username".
Using keyboard-interactive authentication.
Password: ********
Last login: Wed Oct 21 20:03:28 2009 from system25
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
bash-3.00$

Now https://localhost:9443 from Windows system will fetch https://10.2.152.2:9443.

Xstartup settings for accessing Solaris Desktop through VNC

Monday, October 19, 2009

Sometimes I find that if I start VNC Server with the default xstartup settings, I often end up landing on a terminal instead of the Solaris desktop (Java Desktop Session), for those of you having the same problem (can't access Solaris desktop through VNC), here is one possible solution which worked for me.

1. cd <HOME>/.vnc, where <HOME> is your home directory.

2. Edit xstartup file.

2.1. The settings which brought me the command line instead of Solaris JDS.
bash-3.00$ cat xstartup
#!/bin/sh
PATH=:/pkg/X11/bin:/import/pkg/X11/bin
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
bash-3.00$
2.2 Replace the contents of xstartup to the one shown below (I commented out some lines, but you may retain these)
bash-3.00$ cat xstartup
#!/bin/sh
#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
#vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &
bash-3.00$
2.3 Restart VNC Server

Kill the VNC Server process with the old xstartup settings (ps -ef | grep Xvnc, then use kill -9 <Xvnc-pid>), remove
<HOME>/.vnc/passwd, start another VNC Server using the vncserver command.


Copyright © 2016 Prasanna Seshadri, www.prasannatech.net, All Rights Reserved.
No part of the content or this site may be reproduced without prior written permission of the author.