Last active
September 2, 2017 03:10
-
-
Save jamiedust/b567dbf0b8302381b925 to your computer and use it in GitHub Desktop.
Useful Bash/Linux SSH tunnelling commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Start SSH agent | |
| eval "$(ssh-agent -s)" | |
| ## Open SSH tunnel on port 3307 | |
| ssh -fN -L 3307:127.0.0.1:3306 sqlaccount@domain.com | |
| ## Check the tunnel is active | |
| sudo netstat -lnp | grep ssh | grep :3307 | |
| ## Close the tunnel | |
| ps aux | grep ssh | grep 3307 # get the pid | |
| kill <pid> # kill process |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment