快速判断
SSH远程访问模式和实用工具。连接到服务器,管理密钥、隧道和传输。
适合任务
- 按 ModelScope 收录说明完成平台、开发或工作流任务。
- 通过下载包离线保存 Skill 内容。
- 结合下载量、访问量和喜欢数评估优先级。
输入与输出
输入:任务目标、上下文材料、平台信息、文件路径、约束条件或需要处理的内容。
输出:按 Skill 说明生成的文档、代码、检查结果、计划、建议或操作步骤。
示例任务
- 使用 ssh 帮我完成当前任务,并先确认必要上下文。
- 根据 ssh 的说明,列出操作步骤和风险检查点。
安装方式
- 下载本站提供的 Skill ZIP 并解压。
- 把解压后的 Skill 目录放入当前 AI 工具支持的
skills目录。 - 如需在线查看原始内容,可打开 GitHub 的
SKILL.md。
风险边界
使用前请检查权限、外部依赖和要处理的数据类型。第三方平台数据、支付、部署、账号和密钥相关内容应先核对官方说明。
SKILL.md 文档介绍
SSH Skill
Use SSH for secure remote access, file transfers, and tunneling.
Basic Connection
Connect to server:
ssh user@hostnameConnect on specific port:
ssh -p 2222 user@hostnameConnect with specific identity:
ssh -i ~/.ssh/my_key user@hostnameSSH Config
Config file location:
~/.ssh/configExample config entry:
Host myserver
HostName 192.168.1.100
User deploy
Port 22
IdentityFile ~/.ssh/myserver_key
ForwardAgent yesThen connect with just:
ssh myserverRunning Remote Commands
Execute single command:
ssh user@host "ls -la /var/log"Execute multiple commands:
ssh user@host "cd /app && git pull && pm2 restart all"Run with pseudo-terminal (for interactive):
ssh -t user@host "htop"File Transfer with SCP
Copy file to remote:
scp local.txt user@host:/remote/path/Copy file from remote:
scp user@host:/remote/file.txt ./local/Copy directory recursively:
scp -r ./local_dir user@host:/remote/path/File Transfer with rsync (preferred)
Sync directory to remote:
rsync -avz ./local/ user@host:/remote/path/Sync from remote:
rsync -avz user@host:/remote/path/ ./local/With progress and compression:
rsync -avzP ./local/ user@host:/remote/path/Dry run first:
rsync -avzn ./local/ user@host:/remote/path/Port Forwarding (Tunnels)
Local forward (access remote service locally):
ssh -L 8080:localhost:80 user@host
# Now localhost:8080 connects to host's port 80Local forward to another host:
ssh -L 5432:db-server:5432 user@jumphost
# Access db-server:5432 via localhost:5432Remote forward (expose local service to remote):
ssh -R 9000:localhost:3000 user@host
# Remote's port 9000 connects to your local 3000Dynamic SOCKS proxy:
ssh -D 1080 user@host
# Use localhost:1080 as SOCKS5 proxyJump Hosts / Bastion
Connect through jump host:
ssh -J jumphost user@internal-serverMultiple jumps:
ssh -J jump1,jump2 user@internal-serverIn config file:
Host internal
HostName 10.0.0.50
User deploy
ProxyJump bastionKey Management
Generate new key (Ed25519, recommended):
ssh-keygen -t ed25519 -C "your_email@example.com"Generate RSA key (legacy compatibility):
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"Copy public key to server:
ssh-copy-id user@hostCopy specific key:
ssh-copy-id -i ~/.ssh/mykey.pub user@hostSSH Agent
Start agent:
eval "$(ssh-agent -s)"Add key to agent:
ssh-add ~/.ssh/id_ed25519Add with macOS keychain:
ssh-add --apple-use-keychain ~/.ssh/id_ed25519List loaded keys:
ssh-add -lMultiplexing (Connection Sharing)
In ~/.ssh/config:
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600Create socket directory:
mkdir -p ~/.ssh/socketsKnown Hosts
Remove old host key:
ssh-keygen -R hostnameScan and add host key:
ssh-keyscan hostname >> ~/.ssh/known_hostsDebugging
Verbose output:
ssh -v user@hostVery verbose:
ssh -vv user@hostMaximum verbosity:
ssh -vvv user@hostSecurity Tips
- Use Ed25519 keys (faster, more secure than RSA)
- Set
PasswordAuthentication noon servers - Use
fail2banon servers to block brute force - Keep keys encrypted with passphrases
- Use
ssh-agentto avoid typing passphrase repeatedly - Restrict key usage with
command=in authorized_keys