ssh-tool
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSSH Tool
SSH 工具
Execute commands on remote servers via SSH. Supports key-based authentication, tunnels, and file transfers.
通过SSH在远程服务器上执行命令。支持基于密钥的认证、隧道和文件传输。
Setup
设置
Requires SSH access to remote servers. Uses system SSH client.
需要拥有远程服务器的SSH访问权限。使用系统SSH客户端。
Usage
使用方法
Execute a Command
执行命令
bash
{baseDir}/ssh-tool.js --host server.example.com --user ubuntu --command "ls -la"bash
{baseDir}/ssh-tool.js --host server.example.com --user ubuntu --command "ls -la"With Key File
使用密钥文件
bash
{baseDir}/ssh-tool.js --host server.example.com --user ubuntu --key /path/to/key --command "uptime"bash
{baseDir}/ssh-tool.js --host server.example.com --user ubuntu --key /path/to/key --command "uptime"With Password
使用密码
bash
{baseDir}/ssh-tool.js --host server.example.com --user ubuntu --password "secret" --command "df -h"bash
{baseDir}/ssh-tool.js --host server.example.com --user ubuntu --password "secret" --command "df -h"Interactive Shell
交互式Shell
bash
{baseDir}/ssh-tool.js --host server.example.com --user ubuntu --key /path/to/key --shellbash
{baseDir}/ssh-tool.js --host server.example.com --user ubuntu --key /path/to/key --shellOptions
选项
| Option | Description | Required |
|---|---|---|
| Remote hostname or IP | Yes |
| SSH username | Yes |
| Command to execute | Yes* |
| Path to SSH private key | No |
| SSH password | No |
| SSH port (default: 22) | No |
| Start interactive shell | No |
| Command timeout in seconds | No (default: 30) |
| 选项 | 描述 | 是否必填 |
|---|---|---|
| 远程主机名或IP | 是 |
| SSH用户名 | 是 |
| 要执行的命令 | 是* |
| SSH私钥路径 | 否 |
| SSH密码 | 否 |
| SSH端口(默认:22) | 否 |
| 启动交互式Shell | 否 |
| 命令超时时间(秒) | 否(默认:30) |
When to Use
使用场景
- Running commands on remote servers
- Deploying code to production
- Checking server status
- Remote administration tasks
- 在远程服务器上运行命令
- 将代码部署到生产环境
- 检查服务器状态
- 远程管理任务
Notes
注意事项
- Key-based authentication is recommended for automation
- The tool uses system SSH client with ControlMaster for connection reuse
- Supports both password and key-based authentication
- 自动化场景下推荐使用基于密钥的认证
- 该工具使用系统SSH客户端并通过ControlMaster实现连接复用
- 同时支持密码和基于密钥的认证