Friday, September 7, 2007

Getting your hands dirty

Start/Stoping the SSH Server
On your home computer, open a command prompt. To start your SSH server, type the following:

net start opensshd

To stop your SSH server, type the following:

net stop opensshd

To make it easy, you can create a .bat file that will this command. If you make a shortcut to the .bat file in your Windows Startup program group, then when you turn on your home computer in the morning, the servers will startup automatically, and be ready for you when you get to work.

If you have a wired or wireless router at home (Linksys, D-Link, Netgear, etc)
Some routers call it port forwarding and others call it virtual servers, but the setup is very similar no matter what brand you use. You will need to configure your router to route port 443 to the computer where you're running the SSH server. I not going to go into details, but there is usually a browser based interface directly to the router, which will have a page to setup virtual servers. Configure it to forward port 443 to your SSH server computer, port 443.

Setup Putty at Work/School
Copy putty.exe to somewhere on your hard drive at work. c:\ will do fine, or anywhere else you want. Your desktop is convenient but kind of obvious. If you don't have permissions to write files to your hard drive, just copy putty.exe and shunnel.bat to a floppy disk or burn them onto a CD. Take the disk to work and run Putty from the appropriate drive.

Open Notepad and copy the following into it, change the bold part where necessary;

putty -D 8080 -P 443 -ssh homeIP
  • homeIP should be the IP address of your home machine that you wrote down in the Addresses section above.
Save the file as shunnel.bat in the same directory that you saved putty.exe.

Note for advanced users: If your computer at work is already configured to use a proxy server, you need to configure Putty a little differently, but this may still work.

Open Putty in graphical mode, input your connection setting, and also copy the proxy settings from Internet Explorer to Putty's proxy configuration screen. Putty should now create a secure tunnel through the proxy at work to your computer at home... pretty neat trick.


Create your tunnel
At work, simply double click shunnel.bat to initiate the shunnel. A Putty window will popup asking for a login name and password. Type the user name and password you created above on the Windows account. If it works, you will be presented with a DOS prompt waiting for a command. This is actually a command prompt to your HOME machine. You can use it if you want, but as long as this command prompt is open, your tunnel is alive. To close the tunnel, type exit or close the window.

For Advanced Users
If you are very familiar with SSH and know what you are doing, you can set this up so you don't have to enter a password each time you create the shunnel. You have to install OpenSSH as your SSH client and then setup key based authentication by creating a public and private key on your work computer. Install the public key on the SSH server on your home computer. Thanks to Robert W. for this suggestion. I may go into more detail on how do set this up in the future.

No comments: