Taken from https://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html Map remote host:port to local ssh -L 9000:localhost:5432 user@example.com Map local port to remote host:port ssh -R 9000:localhost:3000 user@example.com