Last active
April 5, 2021 11:34
-
-
Save Belval/48d2d7222466c524f3b1f9e83ab19e48 to your computer and use it in GitHub Desktop.
A script to setup ssh tunnelling with autossh on a client
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
# First run setup_autossh_server.sh on your server THEN run this one | |
# Install autossh | |
sudo apt install autossh | |
# Create user tunnel | |
sudo useradd -m tunnel | |
sudo su tunnel | |
# Create key pair | |
ssh-keygen | |
# Copy it to the server | |
ssh-copy-id -i tunnel@[YOU IP/DOMAIN HERE] | |
autossh -nNT -L [PORT]:localhost:[PORT] tunnel@[YOU IP/DOMAIN HERE] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment