Saturday, September 25, 2010

Port Forwarding, The way I use SSH

"Secure Shell or SSH is a network protocol that allows data to be exchanged using a secure channel between two networked devices." Wikipedia.
That is just an abstract definition. I use SSH to do much more. Here are just some simple commands that I used to run for such a different reasons:

Whenever I need to pass stupid filtering of stupid government

ssh -D 8888 root@

"" is just the host that you want to connect it. I assumed that is a SSH enabled machine.
This command simply forwards the remote machine's HTTP port to my local machine. So I just need to use a socks4 proxy like this :
So whatever you do using your browser will forward to the remote machine. The channel between your local machine and the remote one is pretty secured. However, the remote machine should be trusted.

Whenever I need to connect a remote MS-SQLServer on a windows machine using my Linux machine
Assume a service such as SQLServer which runs on a machine that is hosted in a remote LAN with [] IP address. Assume you just can connect to another machine that is hosted in the same LAN using:
ssh root@

Assume again the MS-SQLServer uses the port number 1433.
I need to connect to the ssh server machine using ssh root@ moreover I need to forward to my local machine. This is the simple solution:
ssh -L 1433: root@ -N

The pattern is "ssh -L myPort:host:hostPort". -N is useful for just forwarding ports and nothing else.

The connections could be same as below map:

my machine ssh server MS-SQLServer <===> <===>

-Install OpenSSH if you need to provide SSH over Windows servers.
-To access ports under 1024 you should have root privilege.

No comments:

Post a Comment