Skip to content

Commit

Permalink
autossh: refresh (tldr-pages#5718)
Browse files Browse the repository at this point in the history
  • Loading branch information
bl-ue authored Apr 17, 2021
1 parent ee0f578 commit cda6f2d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions pages/common/autossh.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# autossh

> Runs, monitors and restarts SSH connections.
> Auto-reconnects to keep port forwarding tunnels up. Accepts all ssh flags.
> More information: <https://harding.motd.ca/autossh>.
> Run, monitor and restart SSH connections.
> Auto-reconnects to keep port forwarding tunnels up. Accepts all `ssh` flags.
> More information: <https://www.harding.motd.ca/autossh>.
- Open an SSH session, restarting when a monitoring port fails return data:
- Start an SSH session, restarting when a monitoring port fails to return data:

`autossh -M {{monitor_port}} {{ssh_command}}`
`autossh -M {{monitor_port}} "{{ssh_command}}"`

- Open an SSH session which forwards a local port to a remote one, restarting if necessary:
- Forward a local port to a remote one, restarting when necessary:

`autossh -M {{monitor_port}} -L {{local_port}}:localhost:{{remote_port}} {{user}}@{{host}}`

- Fork before executing ssh (runs in the background) and don't open a remote shell:
- Fork `autossh` into the background before executing `ssh` and don't open a remote shell:

`autossh -f -M {{monitor_port}} -N {{ssh_command}}`
`autossh -f -M {{monitor_port}} -N "{{ssh_command}}"`

- Run autossh in the background, with no monitoring port, instead relying on SSH keep-alives every 10 seconds to detect failure:
- Run in the background, with no monitoring port, and instead send SSH keep-alive packets every 10 seconds to detect failure:

`autossh -f -M 0 -N -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" {{ssh_command}}`
`autossh -f -M 0 -N -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" "{{ssh_command}}"`

- Run autossh in the background, with no monitoring port, no remote shell, exiting if the port forward fails:
- Run in the background, with no monitoring port and no remote shell, exiting if the port forward fails:

`autossh -f -M 0 -N -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -o ExitOnForwardFailure=yes -L {{local_port}}:localhost:{{remote_port}} {{user}}@{{host}}`

- Run autossh in the background with debug output logged to a file and ssh verbose output logged to a second file:
- Run in the background, logging `autossh` debug output and `ssh` verbose output to files:

`AUTOSSH_DEBUG=1 AUTOSSH_LOGFILE={{log_file}} autossh -f -M {{monitor_port}} -v -E {{ssh_log_file}} {{ssh_command}}`
`AUTOSSH_DEBUG=1 AUTOSSH_LOGFILE={{path/to/autossh_log_file.log}} autossh -f -M {{monitor_port}} -v -E {{path/to/ssh_log_file.log}} {{ssh_command}}`

0 comments on commit cda6f2d

Please sign in to comment.