Skip to content

Instantly share code, notes, and snippets.

@AkdM
Last active March 23, 2018 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkdM/2770e4e09fd697a05cc08cbb2c927be5 to your computer and use it in GitHub Desktop.
Save AkdM/2770e4e09fd697a05cc08cbb2c927be5 to your computer and use it in GitHub Desktop.
Bind port from SSH locally

If you want to bind the port 19999 (netdata default port for instance) to port 12345:

ssh -N -L 12345:localhost:19999 $SSH_USER@$SSH_IP -p $SSH_PORT

If you need to execute it in background, simply add the -f flag:

ssh -fN -L 12345:localhost:19999 $SSH_USER@$SSH_IP -p $SSH_PORT

then kill it with kill -9 $PID

(find the PID by typing ps aux | grep ssh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment