This skill enables connecting to remote Linux hosts via SSH and executing commands, transferring files, and managing server configurations. This skill should be used when the user wants to:
This skill provides a complete workflow for connecting to remote Linux hosts via SSH: managing host configurations (save, list, test), executing commands remotely, and transferring files. It supports SSH key authentication, password authentication, and key-with-passphrase authentication. Connection configurations are persisted locally for reuse.
All scripts are located in the scripts/ directory of this skill. Set them as executable before first use:
chmod +x scripts/ssh_config_manager.sh scripts/ssh_connect.sh scripts/ssh_file_transfer.sh
Before connecting, determine if a saved configuration exists or collect connection details from the user.
Check for saved hosts:
bash scripts/ssh_config_manager.sh list
If the target host is already saved, proceed to Step 3. Otherwise, collect the following from the user:
| Parameter | Required | Default | Description |
|---|---|---|---|
| Host/IP | Yes | - | Server hostname or IP address |
| Port | No | 22 | SSH port number |
| Username | Yes | - | Login username |
| Auth Type | Yes | key | One of: key, password, key_passphrase |
| Key Path | If key auth | ~/.ssh/id_rsa | Path to SSH private key file |
| Description | No | - | Friendly description for the host |
To collect this information from the user, ask a focused question like:
"To connect to your Linux server, I need the following information:
- Hostname or IP address
- Username
- Authentication method (SSH key / password / key with passphrase)
- SSH port (default: 22)
- Path to SSH key (if using key auth, default: ~/.ssh/id_rsa)"
Save the host configuration for future reuse:
bash scripts/ssh_config_manager.sh save <alias> '{"host":"<ip>","port":22,"username":"<user>","auth_type":"key","key_path":"~/.ssh/id_rsa","description":"My server"}'
The alias is a short memorable name chosen by or suggested to the user (e.g., dev-server, prod-web1).
Supported auth_type values:
key — SSH private key authentication (recommended, most secure)password — Password authentication (prompted at connect time, never stored)key_passphrase — SSH key with passphrase (passphrase prompted at connect time)Always test the connection before executing tasks:
bash scripts/ssh_config_manager.sh test <alias>
If the test fails, refer to references/ssh_troubleshooting.md for common issues and solutions. Read that file with:
cat references/ssh_troubleshooting.md
Single command:
bash scripts/ssh_connect.sh <alias> "<command>"
Multiple commands (pipe-delimited):
bash scripts/ssh_connect.sh <alias> --multi "cd /var/log|tail -n 50 syslog|df -h"
Run a local script on remote host:
bash scripts/ssh_connect.sh <alias> --script /path/to/local/script.sh
Direct connection (without saved config):
bash scripts/ssh_connect.sh --direct user@host -p 22 -i ~/.ssh/id_rsa "uname -a"
Upload a file:
bash scripts/ssh_file_transfer.sh upload <alias> /local/path /remote/path
Download a file:
bash scripts/ssh_file_transfer.sh download <alias> /remote/path /local/path
Sync directories (requires rsync):
bash scripts/ssh_file_transfer.sh sync-up <alias> /local/dir /remote/dir
bash scripts/ssh_file_transfer.sh sync-down <alias> /remote/dir /local/dir
List all saved hosts:
bash scripts/ssh_config_manager.sh list
View a specific host's config:
bash scripts/ssh_config_manager.sh get <alias>
Delete a saved host:
bash scripts/ssh_config_manager.sh delete <alias>
Configuration storage location: ~/.config/ssh-skill/hosts.json
bash scripts/ssh_connect.sh <alias> --multi "uname -a|uptime|free -h|df -h|systemctl list-units --state=failed"
bash scripts/ssh_connect.sh <alias> "tail -n 100 /var/log/syslog"
bash scripts/ssh_file_transfer.sh sync-up <alias> ./dist /var/www/myapp
bash scripts/ssh_connect.sh <alias> "cd /var/www/myapp && npm install --production && pm2 restart all"
bash scripts/ssh_connect.sh <alias> "sudo systemctl restart nginx"
bash scripts/ssh_connect.sh <alias> "sudo systemctl status nginx"
bash scripts/ssh_connect.sh <alias> --multi "sudo apt update|sudo apt list --upgradable"
When a connection or command fails, read the troubleshooting reference:
cat references/ssh_troubleshooting.md
Common quick fixes:
chmod 600 ~/.ssh/id_rsa) and that the public key is on the serverssh-keygen -R <hostname> and reconnect~/.config/ssh-skill/ with user-only accessStrictHostKeyChecking=accept-new to auto-accept new host keys while rejecting changed keys