SSH Tunnel

Aug 14, 2012·
Julio Batista Silva
Julio Batista Silva
· 1 min read
blog

Tunneling or tunneling is a very useful technique to bypass restrictions and create an encrypted channel for data traffic.

SOCKS

ssh -ND 8888 julio@host

Parameters:

  • -N: do not execute commands
  • -D: run a proxy server on the specified port
  • -f: run in the background
  • -C: enable compression

Firefox

Edit » Preferences » Advanced » Settings… » Manual proxy configuration:

  • SOCKS Host: localhost
  • Port: 8888

Chromium

$ chromium --proxy-server="socks5://localhost:8888" \
            --proxy-bypass-list="192.168.15.10;127.0.0.1:8080;*.google.com" \
            --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE localhost"

Jump Server

Let’s say there is a database (PostgreSQL on port 5432) that is only accessible from the local network. If you have SSH access to a machine on that network, you can interact with the database as follows:

ssh -N -L 127.0.0.1:5434:$DB_HOST:5432 my_server
pg_dump --verbose --create --schema-only --no-owner -d nome_bd -h localhost -p 5434 -U usuario --password -f dump.sql
Julio Batista Silva
Authors
Senior Cloud Developer

I’m a Brazilian computer engineer based in Germany, passionate about tech, science, photography, and languages.

I’ve been programming for about two decades already, exploring everything from mobile apps and web development to machine learning. These days I focus on cloud SRE and data engineering.

I volunteer in the open source and Python communities, helping organize PyCon DE and PyData Berlin, mentoring, and contributing with code and translations.

On my blog, I share Linux tips, setup guides, and personal notes I’ve written for future reference. I hope others find them helpful as well. The content is available in multiple languages.

Browse my gallery for some of my photography.

Away from the keyboard, you’ll find me at concerts, playing clarinet, cycling, scuba diving, or exploring new places, cultures, and cuisines.

Always happy to connect! 🙂

comments powered by Disqus