Features
SSH connection testing, remote command execution, file upload and download, background task management. In container scenarios, automatically wraps docker/kubectl.
Runtime Environment
- Client:Windows(Git Bash/MSYS2)、macOS、Linux
- Server:Linux
Usage
bash connect/scripts/ssh-test.sh <profile>
bash connect/scripts/ssh-exec.sh <profile> <command>
bash connect/scripts/ssh-upload.sh <profile> <local> <remote>
bash connect/scripts/ssh-download.sh <profile> <remote> <local>
bash connect/scripts/ssh-job.sh start|status|output|kill|list|stream <profile> [args]
Quotes and Special Characters
Remote commands go through multiple layers of shell interpretation (local shell → ssh → remote shell → docker exec → shell inside the container), and nested quotes are highly error-prone.
- Complex commands(containing quotes, variables, pipes, etc.): it is recommended to write them as script files, upload them to the server via
ssh-upload.sh, and then execute them, avoiding multi-layer nested quotes in inline commands - Simple commands: can be passed inline directly; the script already handles basic escaping
- Password authentication is passed via environment variable (
sshpass -e) and is not exposed on the command line
Notes for Windows Clients
- ControlMaster session multiplexing is unavailable on Windows (the script automatically detects this and skips it)
$PATHand other environment variables may be expanded by Windows paths in Git Bash, causing errors when passed to the remote end. It is recommended to use the upload-script approach instead of$PATHreferences in inline commands- Quoting is automatically handled when the identity_file path contains spaces
Token Constraints
- Remote command output: prefer filtering parameters (--tail/--head/--grep); reading complete large logs is prohibited
- Background task output: first use status to check the size; if >10KB, only read the tail; if >100KB, grep for errors first
- Status checks: check the summary first, then dig deeper as needed
- Repeated information: do not restate known content