Skip to content

Instantly share code, notes, and snippets.

@leonlaser
Last active March 26, 2019 10:32
Show Gist options
  • Save leonlaser/ccc4d1a2cf058e78b9109a5936dc1e18 to your computer and use it in GitHub Desktop.
Save leonlaser/ccc4d1a2cf058e78b9109a5936dc1e18 to your computer and use it in GitHub Desktop.
[Forward remote port via ssh to localhost] #ssh #portforwarding #network #bash
#!/bin/bash
set -o errexit
# use -f to run in background
ssh $user@$host -NL $localport:localhost:$remoteport
echo "Forwarding ${host}:${remoteport} to localhost:${localpost}. (Press ctrl+c to stop)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment