Monday, October 3, 2011

SSH and you #2 - doing it right.

ok, so if you followed my previous tutorial with freeSSHd, you might have noticed some pesky errors....
when i wrote that, i was testing everything on a LAN network, and it all seemed to go well.... but i recently started using it at college and i was baffled to see an error every 2 minutes or so.

in this tutorial, we will talk about how to set up winSSHd.... as the name implies, it is win (well, its for windows).  some of this tutorial will be the same as the last, however the majority of it involving hosting has changed.



to set this up, we are going to need two programs and a good (not internet explorer) internet browser.

  • WinSSHD - the host we will run at home. download
  • PuTTY - the client we will use to connect your home computer. download
  • firefox (or any other web browser, but this tutorial will use firefox) download

configuring WinSSHd:
when you open up the installer, choose to install a new winsshd site, and accept the license agreement. click next, and choose to use the personal version, NOT the trial.
click next until its done installing and the server control panel is open.

when it is, click on open easy settings (if it doesn't open automatically).
winSSHD easy settings


go to the virtual accounts tab.
make your account here -- your virtual account name is your login name, password would be the password... make sure you check login allowed, otherwise your account will be disabled. file transfer is for sftp, terminal is your ssh terminal, and port forwarding is for tunneling connections.
check box in winSSHD easy settings


Port Forwarding:
next comes port forwarding.... every router is different, but some steps are the same. first you need your default gateway ip, just open cmd (click start, and type cmd in the start menu) and type 'ipconfig' and look for it.

CMD defult gateway

type that in your internet browser. it might ask for a username and password. if that is the case, just look up what the defult user / pass are. now look for a port forwarding section (look around or google where it is). when you find it... add a new forwarded port... use port 22, tcp + udp, name it whatever you want, and set the ip your forwarding to to be your pc's ip (which will also show up when you typed in ipconfig, chances are its 192.168.1.***)
CMD ip address


Configuring PuTTY:
after you have your ports set up, we just have to configure firefox and putty. putty is the program that you will need to run at your workplace or school.... NOT on your home computer. (however, run it and familiarize your self with it).
open putty up, and on the left side look for ssh. click on it. now enable compression. this just speeds up the data being sent between the computers.
putty enable compression
now expand the SSH section on the left by clicking the +. then click on tunneling.
under source port, put any port that is higher than 2000... i used 6789. now in the destination box, type 127.0.0.1:6789 (or whatever port you used). make sure you check the dynamic box, then press add.
it should look like this. this tells putty to look for traffic on the localhost at port 6789... which is where firefox will be directing its internet traffic to.
putty set up tunnel listen port
now click on Session up on the top left. in the 'Host Name (or ip address)" box, put the IP to your home computer. to get this ip, go to whatismyip.com and it will tell you. for port, put down 22 and make sure SSH is clicked.you should be able to connect, and it will ask you for your username and password.

Configuring Firefox.
open up firefox and go to Tools -> options.
click on the advanced tab up top.
click on network, then settings.
firefox advanced network settings

click on manually configure proxy, under the SOCKS settings, put in 127.0.0.1 and then put in whatever port you used in putty, in this case, 6789. this tells firefox to send all its http traffic (port 80) through port 6789 on the local host.... which is exactly where putty is looking for traffic.
firefox manual proxy settings
press ok, firefox will now connect through your SSH tunnel.
make sure when your done you switch back to system proxy, otherwise pages will not load when putty is not up.

10 comments:

The Rev. Archimedes said...

This is Amazing, bookmarked your site, thanks for all the useful info

Give Everything said...

this really helps, thanks :)!

cheshire said...

Really great tut bro, bookmarked this.

Wiil44nD said...

thy man I m gonna try this instantly ,)

Daily Car Reviews said...

wow that is some fine ass info ,

thanks for it!

+1 follower

Unknown said...

Don't forget to forward the DNS traffic through the SSH tunnel, or this whole exercise is pointless:

about:config

network.proxy.socks_remote_dns = true

mobabur94 said...

my school computers block every .exe file that isn't part of windows or the already installed programs. so this won't work for me as you need to run putty.exe on the school computer. i tried renaming it to something like mspaint.exe but it didn't work.

they also block pretty much half of the results for any google search..

it's terrible. is there any other way to access some sort of proxy that will allow me to browse reddit?

Michael said...

Awesome tutorial. I was looking for something like this a while ago, then got distracted and forgot about it. Thanks.

AgusFan said...

Great tutorial! =D

Copyfilenames said...

I can't connect putty on windows from iphone safari

Post a Comment