
This article will describe one kind of static SSH tunneling, in which every communication that passes through the tunnel is forwarded to a certain destination host. This is useful for applications like MySQL where remote server access is necessary, but the application’s default means of remote access is less secure than SSH. SSH tunneling, also known as SSH port forwarding, maps a local IP and port to a remotely accessible resource, allowing local applications to make remote connections in a secure manner. Follow these steps to set up an SSH tunnel with PuTTY::Īn SSH Tunnel provides an encrypted connection between a local computer and remote server using the SSH protocol.Now you can use the saved connection to log in to your server and after you successfully log in, every time you connect to port 123 on your host you will actually connect to port 456 on the server.

Then navigate back to session and click Save to keep your settings for the next time. In the tree on the left side, navigate toĪnd create a new local tunnel with the source port 123 and the destination localhost:456.

Start Putty and enter your usual connection settings (Hostname or IP address) To set it up with Putty ( local forward example) The script will use tsocks or ALL_PROXY variable: ALL_PROXY="socks5h://localhost:5000" tsocks scriptįor youtube-dl youtube-dl -proxy socks5://127.0.0.1:5000 Wget needs tsocks, because wget doesn’t support proxies. Or just curl -proxy socks5h://localhost:5000 tsocks thunderbirdĮasy to use with curl: ALL_PROXY="socks5h://localhost:5000" curl You can now start program with tsocks in front of it, so that it uses the socks proxy. Server = localhost # proxy-server (your host) more general: use tsocks application with a file /etc/nfĬontents of the config file: local = 192.168.1.0/255.255.255.0 # no proxy for local network You can now surf in the internet without anybody at the strange place knowing what you do. Now edit the following values: string localhost Type in the Firefox address bar: about:config If you want to tunnel your browser traffic (with Firefox for example), you do not only want to access ONE website (remotehost and port), but surf freely in the On your computer (your host) you do: ssh -D 5000 remotehost # or the equivalent option "dynamic" with puttyįor this you can edit your Firefox configuration, so that your browser uses your socks proxy. What does a Socks proxy do? It accepts all your requests and forwards it dynamically to the remote hosts and ports, that the original program wanted it to ( see examples below). Or you need to help it with some tricks ( see examples below). Your program using the tunnel needs to support socks proxies. D is like -L (local) but instead of fowarding to one and only one specific remotehost and port, SSH acts as a SOCKS proxy to the remotehost. Ssh -R sourcePort:forwardToHost:onPort connectToHost means: connect with ssh to connectToHost, and forward all connection attempts to the remote sourcePort to port onPort on the machine called forwardToHost, which can be reached from your local machine. remote: -R Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side.Ssh -L sourcePort:forwardToHost:onPort connectToHost means: connect with ssh to connectToHost, and forward all connection attempts to the local sourcePort to port onPort on the machine called forwardToHost, which can be reached from the connectToHost machine. local: -L Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.

The machine, where the ssh tunnel command is typed (or in your case: Putty with tunneling is started) is called »your host«.
