4 ms·
the ssh (or in this case autossh) oneliner for this would be something like: autossh -M 0 -q -f -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -R
by paulgerhardt 16y ago
the ssh (or in this case autossh) oneliner for this would be something like:
autossh -M 0 -q -f -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -R 20080:localhost:80 -R 20022:localhost:22 [USER]@[REMOTE-HOST]
where 20022 is the port you can remotely ssh into from anywhere, and 20080 would be the http port on a remote system publicly visible that you have access to. Autossh will respawn failed connections (say the internet connection goes out) but will fail silently with "-q" (say you haven't authorized the RSA keys yet.)
I think this will work for ssh too if you drop the "-M" flag. You'll probably need keys, and it would be a good idea to make a specific user with no shell access, and restrict the ssh keys as the article mentions...