Created
March 3, 2022 01:14
-
-
Save faisalthaheem/ad75ef0fe84893b47c5fe5fe8a86229c to your computer and use it in GitHub Desktop.
autossh to jumpbox with reverse proxy
This file contains 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
#should be placed at /etc/rc.local and marked executable (+x) | |
#package autossh should be installed | |
#this script will automatically establish ssh connection to remote host on boot as well as restore it in case the connection breaks | |
#the following example reverse proxies port 4000 on host to port 80 on localhost (localhost = originating server where this script runs) | |
#!/bin/bash | |
autossh -M 10984 -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" \ | |
-i /path/to/id_rsa -N -g -R 127.0.0.1:4000:127.0.0.1:80 user@host | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment