| name | ssh-connect |
| description | Use when you need to SSH into a remote machine to run commands or open an interactive shell using credentials loaded from a .env file (SSH_HOST, SSH_USER, and key or password), avoiding interactive password prompts. |
SSH Connect Skill
SSH into remote machines using credentials from .env file - no password prompts.
Setup
- Create
.env file in project root with your SSH credentials:
SSH_HOST=192.168.1.100
SSH_USER=ubuntu
SSH_KEY_PATH=~/.ssh/id_rsa
SSH_PASSWORD=your_password
- Ensure Python dependencies are installed:
pip install paramiko python-dotenv
Usage
CLI
python .claude/skills/ssh-connect/ssh_connect.py
python .claude/skills/ssh-connect/ssh_connect.py "ls -la"
python .claude/skills/ssh-connect/ssh_connect.py "cd /app && git pull && docker-compose restart"
Python API
from ssh_connect import SSHClient
with SSHClient() as ssh:
output = ssh.run("hostname")
print(output)
with SSHClient(host="192.168.1.100", user="ubuntu", key_path="~/.ssh/id_rsa") as ssh:
output = ssh.run("uptime")
Environment Variables
| Variable | Required | Description |
|---|
SSH_HOST | Yes | Remote hostname or IP |
SSH_USER | Yes | SSH username |
SSH_PORT | No | SSH port (default: 22) |
SSH_KEY_PATH | No* | Path to SSH private key |
SSH_PASSWORD | No* | SSH password |
*One of SSH_KEY_PATH or SSH_PASSWORD is required.
Security Notes
- Prefer SSH keys over passwords when possible
- Add
.env to .gitignore to prevent credential leaks
- Never commit credentials to version control