Ssh

ssh socks proxy

Working outside and do not want to share your ip packets over wlan with some one else? then use ssh and its integrated socks proxy to create a tunnel between your laptop and a server on which you have ssh account. You connect via tunnel with this server and configure mozilla with proxy configuration to use it.

  1. First open tunnel
 ssh -D 1080 <ssh-server>
this opens a ssh session and the tunnel. If you want only to open a tunnel use
 ssh -fN -D 1080 <ssh-server>

Then write in the browser that you want to use a socks proxy. As address you give "localhost" and port is 1080 because of the sample. Feel free to change that.

forward a local port

 ssh -L localport:receiverhost:receiverport user@remotehost

establishs a ssh connection to remotehost. Afterwards every connection query to the local host on port localport will be redirect ciphered to remotehost and then from remotehost unciphered to receiverhost:receiverport what is in most of the cases localhost.

An example is the use of an smtp server as postfix without having it configured for connection over the internet. This is the default property of postfix to prevent spammer abuse. If you have a ssh account this is no problem. Just open a tunnel to the remote host which redirect packets to the remote host and then to a port on the remote machine.

 ssh -L 10025:localhost:25 user@host.de

or

 ssh -fN -L 10025:localhost:25 user@host.de

Afterwards every package which goes to local port 10025 will be redirected to host.de and there to localhost:25.

A fine solution for people which have enough of configuring and compiling imap server like cyrus.

forward a remote port to the local host

 ssh -R port:lhost:lport user@host

establishs a connection to host and listen on port port. An expample is a connection from a secure host to a public host to give the oportunity of an ssh connection to the secure host.

To access an host behind some firewalls from the internet just establish a ssh tunnel into a host in the internet. Type in from secured host:

 ssh -R 2222:localhost:22 user@publichost

Then you can connect to the publichost with

 ssh -P 2222 user2@publichost 

and you will be redirected to the secured host and have login there.