Skip to content

Instantly share code, notes, and snippets.

@henri
Last active October 23, 2025 09:31
Show Gist options
  • Select an option

  • Save henri/bdcb2fe95ccccb90b12394287f86ba11 to your computer and use it in GitHub Desktop.

Select an option

Save henri/bdcb2fe95ccccb90b12394287f86ba11 to your computer and use it in GitHub Desktop.
ssh tunnel cheatsheet
#
# ssh using the -N falg for establishing a tunnel is great.... but somtimes it is difficult to know if authentication has
# been successful (especially if you have any kind of extended login delays setup on a remote system) and you are
# authenticating with a password (did I type that correctly).
#
# this approach requires little additional setup and prevents lots of verbosity regarding the login.
#
# recive notification that authentication succeeded - bash
ssh -v <user>@<remote-host> -p <port> -L <localport>:<tunnel-host>:<remoteport> -N 2> >(grep Authenticated >&2)
# recive notification that authentication succeeded - fish
ssh -v <user>@<remote-host> -p <port> -L <localport>:<tunnel-host>:<remoteport> -N 2>| grep Authenticated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment