You're reading a how-to that is part of our new Learn Beta. Track your progress. Earn badges. Learn IT! Read More about the beta experience.

Introduction

This How-To will demonstrate how to use PuTTY in order to gain VNC or HTTP remote access to a host through SSH tunneling.

I am utilizing a ZyXEL ZyWALL USG 50 firewall as the SSH server with which I am tunneling any TCP port I choose for remote access.

I presume that the following prerequisites have been established.

1. SSH server. In this case a ZyWALL USG 50 firewall is acting as my SSH server.
2. SSH username and password created on SSH server. We will use "sshuser" in this example.
3. SSH TCP Port 22 is open to the outside world.
4. PuTTY has been downloaded and saved to C:\PuTTY.exe
5. TightVNC has been installed.

Steps
(2 total)

1

HTTP Example:

1. Create a .bat batch file with the following configuration on each of three lines.

We begin with line 1 by invoking the command "start".
This will allow us to continue the batch script without waiting for the first process to exit.
We then launch the putty.exe file. The "-N" switch tells PuTTY not to initialize a SSH command shell.
The "-L" switch will allow us to tunnel various local TCP ports.
Next is the meat of the tunneling.
"127.0.0.9:80:10.1.101.9:80" we are using the loopback IP Address "127.0.0.9" with local port "80" tunneling to remote IP Address "10.1.101.9" with remote port "80".
"-l" means login or username and "-pw" is the password.
The last part of the command is the SSH server IP Address or hostname. We are using "spiceworksexample.no-ip.org" for this how-to.

Line 2 is very simple since all we want to do is delay a few seconds in order for the SSH tunnel to be established before launching the web browser.
We "ping" the "localhost" five time with the "-n 5" switch.

Finally on Line 3 we launch the default web browser.

With this simple script I am able to remote access a web based console easily while I am located offsite.

This batch script is very similar.
In this case we are now tunneling TCP port 5900 for Loopback IP Adddress 127.0.0.106 to remote host 10.1.101.106 at port 5900.
The main difference is on Line 3, we have omitted the "start" command and we reference the path to VNC with host and port specified.

Conclusion

Note: I like to make the last octet of the Loopback IP Address the same as the last octet of the remote host IP Address for easy reference.

There you have it. Enjoy SSH tunneling with batch scripts.

0 Comments

A daily dose of today's top tech news, in brief.
You need to hear this.
Reddit gets native video support
Variety reports that Reddit has just introduced a new feature that allows you to upload video clips directly to the service. The feature was ...

For a long time we have been happily using the Dell E Dock. But as Dell are removing the E dock port I need to find a good USB docking station. What is everyone else using? We are a nonprofit so need something cheap.

I am curious about what others think when having to take an exam to qualify for a position. I personally don't feel that a company can really judge a person just by taking a test for a position the company is hiring for. Now I know they are trying to see if this individual is qualified, but sometimes there are questions on these exams that even experts can't answer.