npx skills add ...
npx skills add openhands/extensions --skill ssh
Establish and manage SSH connections to remote machines, including key generation, configuration, and file transfers. Use when connecting to remote servers, executing remote commands, or transferring files via SCP.
npx skills add openhands/extensions --skill ssh
This skill provides capabilities for establishing and managing SSH connections to remote machines.
Windows PowerShell equivalents for SSH config creation, key paths, ssh-agent, and permissions are in references/windows.md.
When prompted, you should ask the user for their password or a private key.
Generate a new SSH key pair:
Copy the public key to the remote server:
Connect using the private key:
Create or edit the SSH config file for easier connections:
Then connect using the alias:
-p PORT: Connect to a specific port-X: Enable X11 forwarding-L local_port:remote_host:remote_port: Set up local port forwarding-R remote_port:local_host:local_port: Set up remote port forwarding-N: Do not execute a remote command (useful for port forwarding)-f: Run in background-v: Verbose mode (add more v's for increased verbosity)Copy a file to the remote server:
Copy a file from the remote server:
Copy a directory recursively:
Start the SSH agent:
Add a key to the agent:
systemctl status sshdnc -zv hostname 22ssh -vvv username@hostnamechmod 600 ~/.ssh/key_name)ssh-keygen -R hostnameThe most basic approach is to ensure proper file permissions:
ssh -i ~/.ssh/key_name username@hostnamemkdir -p ~/.ssh
cat > ~/.ssh/config << 'EOF'
Host alias
HostName hostname_or_ip
User username
IdentityFile ~/.ssh/key_name
Port 22
ServerAliveInterval 60
EOF
chmod 600 ~/.ssh/configssh aliasscp /path/to/local/file username@hostname:/path/to/remote/directory/scp username@hostname:/path/to/remote/file /path/to/local/directory/scp -r /path/to/local/directory username@hostname:/path/to/remote/directory/eval "$(ssh-agent -s)"ssh-add ~/.ssh/key_name# Set correct permissions for private keys
chmod 600 ~/.ssh/id_ed25519
# Set correct permissions for public keys
chmod 644 ~/.ssh/id_ed25519.pub
# Set correct permissions for SSH directory
chmod 700 ~/.ssh