I have a shell account (Debian) and I want all my localhost browser internet traffic to go through that shell account.

I know how to configure the internet browser and how to configure Putty for port forwarding, what I do not know is what I need to do on the server for this to happen.

Anyone knows what I should do on the server so that it will accept port forwarding? It does not seem to work with the default configuration.

  • Are you using something like: ssh -l username -L localport:server:port sshserver?
    – l0c0b0x
    Jun 11, 2009 at 21:22
  • That is local port forwarding it will not allow the OP to tunnel all internet traffic, just the specified server will be browseable thru the tunnel created this way. The OP is probably looking for a SOCKS proxy which is perfectly doable with SSH Jun 11, 2009 at 22:11

4 Answers 4


Inside the sshd_config file just change the #PermitTunnel setting from no to yes.


#PermitTunnel no


PermitTunnel yes

I want all my localhost browser internet traffic to go through that shell account.

ssh -D 8080 -T -f -l username proxy_host
  • Will create a dynamic port forwarding (SOCKS proxy).
  • -T will not allocate a tty
  • -f will make SSH to go immediately into background
    • For this to work you need to use public key authentication
    • at least on debian have a look at ssh-copy-id
  • Now you just need to configure your browser to go thru the specified port

Leave out -Tand -f while testing the setup. The local port forwarding (-L [listenaddress]:localport:remotehost:remoteport ssh_host) will only work for the remotehost (e.g. ssh -L 8080:google.com:80 ssh_host will only forward traffic to google.com over the ssh_host not all web traffic)

If that doesn't work please update your question with the output of the SSH command with the -vvv switch added.


When using ssh -R 8080:google.com:80 ssh_host

on sshd_config

GatewayPorts yes

should be to listen on wildcard or external interface not just loopback.


I'd also recommend this: http://blog.slowb.ro/2013/06/21/create-a-ssh-based-vpn-system/

To summarise, parse -D [port] on to your ssh command, when making a connection. But the port must be on or above port 1025+.

You must log in to answer this question.