autossh on Mac
If you installed autossh 1.4d on Mac OS X via homebrew, it may not work without a specific command line option:
-M specifies monitor port. May be overridden by environment
variable AUTOSSH_PORT. 0 turns monitoring loop off.
Alternatively, a port for an echo service on the remote
machine may be specified. (Normally port 7.)
This option should not be required, but without it autossh will simply exit after showing the help & usage text.
So instead of:
autossh user@host.example.com
use:
autossh -M 1234 user@host.example.com
Instead of changing it every time, you can ask your shell to try a random port:
autossh -M $(($RANDOM%64000 + 1024)) user@host.example.com
If the random port selection fails, just try again.
Finally, you can add an alias for your shell:
alias autossh='autossh -M $(($RANDOM%6400 + 1024))'
No comments:
Post a Comment