Skip to content

Instantly share code, notes, and snippets.

@zero-master
Created April 1, 2014 19:27
Show Gist options
  • Save zero-master/9921261 to your computer and use it in GitHub Desktop.
Save zero-master/9921261 to your computer and use it in GitHub Desktop.
Check if SSH Tunnel Started Successfully!
Use netcat -- often nc on Linux systems:
nc -dvzw10 ${HOSTNAME} 23
Works for me, with a response like:
Connection to ${HOSTNAME} 23 port [tcp/telnet] succeeded!
It also returns 0 on success, and is happy with a simple connection after which it goes away.
-d means not to read anything from the keyboard side
-v means to be verbose (turn this off in a script)
-z means to disconnect after making the connection
-w10 means to wait up to 10 seconds, otherwise give up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment