
Ssh Remote Connection
- 285 installs
- 177 repo stars
- Updated May 10, 2026
- artwist-polyakov/polyakov-claude-skills
ssh-remote-connection is a Claude skill that connects to remote servers over SSH to run commands, read logs, restart services, and manage Docker containers.
About
This skill opens an SSH connection to a remote server so commands can run there, whether an interactive shell or a single command. A developer uses it to check logs, restart services, or manage Docker containers on a server. Connection details and credentials come from a config .env supporting key or password authentication.
- Connects to a remote server over SSH to run commands, check logs, and manage services
- Supports both key-based and password-based authentication via a config .env
- Documents Docker Compose operations like viewing logs and restarting a service
Ssh Remote Connection by the numbers
- 285 all-time installs (skills.sh)
- Ranked #343 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
ssh-remote-connection capabilities & compatibility
Free; needs SSH credentials for the target server and sshpass or expect for password auth.
- Capabilities
- devops
- Works with
- docker
- Use cases
- devops
- Pricing
- Free
What ssh-remote-connection says it does
Universal skill for connecting to remote servers via SSH.
Use when you need to execute commands on a remote server, check logs, restart services, or manage Docker containers.
npx skills add https://github.com/artwist-polyakov/polyakov-claude-skills --skill ssh-remote-connectionAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 285 |
|---|---|
| repo stars | ★ 177 |
| Last updated | May 10, 2026 |
| Repository | artwist-polyakov/polyakov-claude-skills ↗ |
What it does
Run commands, read logs, restart services, or manage Docker containers on a remote server over SSH.
Who is it for?
Running one-off commands and service operations on a remote server over SSH.
Skip if: Running git pull on the server; the user handles git sync manually.
When should I use this skill?
You need to execute commands on a remote server, check logs, restart services, or manage Docker containers.
What you get
Commands run on the remote server and their output is returned to the agent.
- remote command output
- docker service status
By the numbers
- supports 3 auth modes: auto, key, and password
Files
SSH Remote Connection
Universal skill for connecting to remote servers via SSH.
Usage
# Interactive shell
scripts/connect.sh
# Run command directly
scripts/connect.sh "docker compose logs backend --tail 50"Setup
For Claude Code (local)
1. Copy config template:
cp config/.env.example config/.env2. Fill in config/.env with actual values
Key-based authentication:
SSH_HOST=your-server.example.com
SSH_USER=ubuntu
SSH_AUTH_METHOD=key
SSH_KEY_PATH=/absolute/path/to/private/key
SSH_KEY_PASSWORD=
SERVER_PROJECT_PATH=/path/to/projectPassword-based authentication:
SSH_HOST=your-server.example.com
SSH_USER=ubuntu
SSH_AUTH_METHOD=password
SSH_PASSWORD='your account password'
SERVER_PROJECT_PATH=/path/to/project3. Make script executable:
chmod +x scripts/connect.shFor Cloud Runtime
Set environment variables in your cloud configuration:
SSH_HOST— server hostname or IPSSH_USER— SSH usernameSSH_PORT— SSH port (optional)SSH_AUTH_METHOD—auto,key, orpassword(optional, defaults toauto)SSH_KEY_PATH— path to private key for key authenticationSSH_KEY_PASSWORD— key passphrase (optional)SSH_PASSWORD— SSH account password for password authenticationSERVER_PROJECT_PATH— project directory on server
For password authentication, the local runtime must have either sshpass or expect. If the host key is not trusted yet, connect once manually or add the host to known_hosts before running non-interactive commands.
Important Notes
- Git operations: Do NOT run
git pullon the server. User will handle git sync manually. - Code location: Code is in a private repo, changes must be pushed first then pulled by user.
- Docker: Use
docker compose(notdocker-compose) on the server.
Example Commands
# View logs
scripts/connect.sh "docker compose logs backend --tail 100"
# Restart service
scripts/connect.sh "docker compose restart backend"
# Rebuild and restart
scripts/connect.sh "docker compose build backend && docker compose up -d backend"
# Check status
scripts/connect.sh "docker compose ps"# Ignore actual config file (contains secrets)
config/.env
# SSH Connection Configuration
# Copy this file to .env and fill in actual values
# Server hostname or IP address
SSH_HOST=your-server.example.com
# SSH username
SSH_USER=ubuntu
# Optional SSH port. Leave empty to use OpenSSH default port 22.
SSH_PORT=
# Authentication method: auto, key, or password.
# auto uses SSH_KEY_PATH when it points to a readable file, otherwise SSH_PASSWORD.
SSH_AUTH_METHOD=auto
# Key authentication: path to SSH private key (absolute path).
SSH_KEY_PATH=
# Key passphrase (optional, leave empty if key has no passphrase).
SSH_KEY_PASSWORD=
# Password authentication: SSH account password.
# If the password contains shell-special characters, wrap it in single quotes.
SSH_PASSWORD=
# Project directory on the server (optional, leave empty for home dir)
SERVER_PROJECT_PATH=/path/to/project
#!/bin/bash
# SSH Connection Script for Remote Servers
# Usage:
# ./connect.sh - Interactive shell
# ./connect.sh "command" - Run command and exit
#
# Configuration:
# - Claude Code (local): use config/.env file
# - Cloud Runtime: set environment variables directly
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIG_DIR="$SCRIPT_DIR/../config"
ENV_FILE="$CONFIG_DIR/.env"
# Load .env file if exists and variables not already set (local mode)
if [ -f "$ENV_FILE" ] && [ -z "$SSH_HOST" ]; then
source "$ENV_FILE"
fi
SSH_AUTH_METHOD="${SSH_AUTH_METHOD:-auto}"
# Validate required variables
if [ -z "$SSH_HOST" ] || [ -z "$SSH_USER" ]; then
echo "Error: Missing required variables"
echo "Required: SSH_HOST, SSH_USER"
echo ""
echo "For Claude Code: copy config/.env.example to config/.env"
echo "For Cloud Runtime: set environment variables"
exit 1
fi
case "$SSH_AUTH_METHOD" in
auto|"")
if [ -n "$SSH_KEY_PATH" ] && [ -r "$SSH_KEY_PATH" ]; then
AUTH_METHOD="key"
elif [ -n "$SSH_PASSWORD" ]; then
AUTH_METHOD="password"
elif [ -n "$SSH_KEY_PATH" ]; then
AUTH_METHOD="key"
else
AUTH_METHOD=""
fi
;;
key|password)
AUTH_METHOD="$SSH_AUTH_METHOD"
;;
*)
echo "Error: Invalid SSH_AUTH_METHOD: $SSH_AUTH_METHOD"
echo "Allowed values: auto, key, password"
exit 1
;;
esac
if [ "$AUTH_METHOD" = "key" ]; then
if [ -z "$SSH_KEY_PATH" ]; then
echo "Error: SSH_KEY_PATH is required for key authentication"
exit 1
fi
if [ ! -r "$SSH_KEY_PATH" ]; then
echo "Error: SSH key is not readable: $SSH_KEY_PATH"
exit 1
fi
elif [ "$AUTH_METHOD" = "password" ]; then
if [ -z "$SSH_PASSWORD" ]; then
echo "Error: SSH_PASSWORD is required for password authentication"
exit 1
fi
else
echo "Error: Missing SSH authentication configuration"
echo "Set SSH_KEY_PATH for key authentication or SSH_PASSWORD for password authentication."
exit 1
fi
# Function to add key to ssh-agent if not already added
add_key_to_agent() {
# Check if key is already in agent
if ssh-add -l 2>/dev/null | grep -Fq "$SSH_KEY_PATH"; then
return 0
fi
# Try to add key
if [ -n "$SSH_KEY_PASSWORD" ]; then
# Use expect to add key with password
if ! command -v expect >/dev/null 2>&1; then
echo "Error: SSH_KEY_PASSWORD requires expect to add the key non-interactively"
exit 1
fi
EXPECT_SSH_KEY_PATH="$SSH_KEY_PATH" EXPECT_SSH_KEY_PASSWORD="$SSH_KEY_PASSWORD" expect -c '
spawn ssh-add $env(EXPECT_SSH_KEY_PATH)
expect "Enter passphrase"
send -- "$env(EXPECT_SSH_KEY_PASSWORD)\r"
expect eof
catch wait result
exit [lindex $result 3]
' > /dev/null 2>&1
else
# Try without password (will prompt if needed)
ssh-add "$SSH_KEY_PATH" 2>/dev/null
fi
}
run_ssh_with_password() {
if command -v sshpass >/dev/null 2>&1; then
SSHPASS="$SSH_PASSWORD" sshpass -e ssh "$@"
return $?
fi
if command -v expect >/dev/null 2>&1; then
EXPECT_SSH_PASSWORD="$SSH_PASSWORD" EXPECT_INTERACTIVE="${EXPECT_INTERACTIVE:-0}" expect -f - -- "$@" <<'EXPECT'
set timeout -1
set password $env(EXPECT_SSH_PASSWORD)
set interactive $env(EXPECT_INTERACTIVE)
log_user 0
spawn ssh {*}$argv
log_user 1
expect {
-nocase -re "are you sure you want to continue connecting.*" {
puts stderr "Error: SSH host key is not trusted yet. Connect once manually or add the host to known_hosts."
exit 6
}
-nocase -re "(password|passcode).*: *$" {
send -- "$password\r"
if {$interactive == "1"} {
interact
catch wait result
exit [lindex $result 3]
}
exp_continue
}
eof {
catch wait result
exit [lindex $result 3]
}
}
EXPECT
return $?
fi
echo "Error: Password authentication requires sshpass or expect."
echo "Install sshpass, install expect, or use SSH key authentication."
return 1
}
run_ssh() {
if [ "$AUTH_METHOD" = "password" ]; then
run_ssh_with_password "$@"
else
ssh "$@"
fi
}
SSH_ARGS=()
if [ -n "$SSH_PORT" ]; then
SSH_ARGS+=("-p" "$SSH_PORT")
fi
if [ "$AUTH_METHOD" = "key" ]; then
# Start ssh-agent if not running
if [ -z "$SSH_AUTH_SOCK" ]; then
eval "$(ssh-agent -s)" > /dev/null 2>&1
fi
# Add key to agent for the initial connection and forwarded auth on the server.
if ! add_key_to_agent; then
echo "Error: Failed to add SSH key to ssh-agent: $SSH_KEY_PATH"
exit 1
fi
SSH_ARGS+=("-A" "-i" "$SSH_KEY_PATH")
else
SSH_ARGS+=("-o" "PreferredAuthentications=password,keyboard-interactive" "-o" "PubkeyAuthentication=no")
fi
# Build command prefix (cd to project dir if specified)
if [ -n "$SERVER_PROJECT_PATH" ]; then
printf -v SERVER_PROJECT_PATH_QUOTED "%q" "$SERVER_PROJECT_PATH"
CD_CMD="cd $SERVER_PROJECT_PATH_QUOTED &&"
else
CD_CMD=""
fi
if [ -n "$1" ]; then
# Run provided command
run_ssh "${SSH_ARGS[@]}" "$SSH_USER@$SSH_HOST" "$CD_CMD $*"
else
# Interactive shell
if [ -n "$CD_CMD" ]; then
EXPECT_INTERACTIVE=1 run_ssh "${SSH_ARGS[@]}" -t "$SSH_USER@$SSH_HOST" "$CD_CMD exec \$SHELL -l"
else
EXPECT_INTERACTIVE=1 run_ssh "${SSH_ARGS[@]}" -t "$SSH_USER@$SSH_HOST"
fi
fi
Related skills
How it compares
Use ssh-remote-connection for quick agent-driven SSH maintenance; use full CI/CD pipelines when changes need audited, repeatable deploy workflows.
FAQ
How do you configure ssh-remote-connection?
ssh-remote-connection reads SSH_HOST, SSH_USER, SSH_KEY_PATH, optional SSH_KEY_PASSWORD, and SERVER_PROJECT_PATH from environment variables or config/.env. Copy the example .env, set the key path, and make the wrapper script executable before use.
What can ssh-remote-connection do on servers?
ssh-remote-connection executes remote bash commands, tails Docker and service logs, restarts Docker Compose services, and runs status checks. It uses SSH agent forwarding (-A) but intentionally does not perform git operations on the remote host.
How is ssh-remote-connection installed?
ssh-remote-connection installs from the artwist-polyakov polyakov-claude-skills marketplace with `/plugin marketplace add artwist-polyakov/polyakov-claude-skills` followed by `/plugin install ssh-remote-connection`, or via `npx skills add` with the --skill flag.