sshlisted
Install: claude install-skill aiskillstore/marketplace
# SSH Skill
Use SSH for secure remote access, file transfers, and tunneling.
## Basic Connection
Connect to server:
```bash
ssh user@hostname
```
Connect on specific port:
```bash
ssh -p 2222 user@hostname
```
Connect with specific identity:
```bash
ssh -i ~/.ssh/my_key user@hostname
```
## SSH Config
Config file location:
```
~/.ssh/config
```
Example config entry:
```
Host myserver
HostName 192.168.1.100
User deploy
Port 22
IdentityFile ~/.ssh/myserver_key
ForwardAgent yes
```
Then connect with just:
```bash
ssh myserver
```
## Running Remote Commands
Execute single command:
```bash
ssh user@host "ls -la /var/log"
```
Execute multiple commands:
```bash
ssh user@host "cd /app && git pull && pm2 restart all"
```
Run with pseudo-terminal (for interactive):
```bash
ssh -t user@host "htop"
```
## File Transfer with SCP
Copy file to remote:
```bash
scp local.txt user@host:/remote/path/
```
Copy file from remote:
```bash
scp user@host:/remote/file.txt ./local/
```
Copy directory recursively:
```bash
scp -r ./local_dir user@host:/remote/path/
```
## File Transfer with rsync (preferred)
Sync directory to remote:
```bash
rsync -avz ./local/ user@host:/remote/path/
```
Sync from remote:
```bash
rsync -avz user@host:/remote/path/ ./local/
```
With progress and compression:
```bash
rsync -avzP ./local/ user@host:/remote/path/
```
Dry run first:
```bash
rsync -avzn ./local/ user@host:/remote/path/
```
## Port Forwarding (Tunnels)
Local forward