Provide shared SSH authentication sessions and connection recovery
Source: target-root/usr/local/lib/solidgroundux/common/sgnd-ssh-deployment.sh
Provide shared SSH authentication sessions and connection recovery
Public functions
- Locate an existing usable SSH authentication agent and export its socket.
- Start or reconnect to a dedicated SSH authentication agent.
- Verify noninteractive SSH access, offering interactive key recovery when needed.
Description
Shared, source-only helpers for SSH-based deployment and publishing workflows. The library:
- Discovers and reuses a working SSH authentication agent.
- Starts or reconnects to a dedicated SSH agent when necessary.
- Verifies non-interactive SSH access to a specified remote host.
- Offers interactive recovery to unlock or install an SSH public key.
Design principles
- Source in the caller process so SSH_AUTH_SOCK reaches ssh and rsync.
- Attempt non-interactive authentication before prompting for recovery.
- Do not prompt when input is not an interactive terminal.
- Use the caller's SolidGroundUX say*/ask helpers for interaction.
Role in framework
- Common Core support for MCM remote deployment and publishing actions.
- Keeps SSH-agent and connection recovery behavior shared across callers.
Non-goals
- A standalone command-line executable.
- Managing remote deployment content or synchronization itself.
Usage
Source this library in the calling executable; do not run it directly.
source /usr/local/lib/solidgroundux/common/sgnd-ssh-deployment.sh
sgnd_ssh_ensure_access "$remote_user" "$remote_host" "$remote_port" "$private_key"
