SSH/SFTP Operations Tool
MyDeskBot provides powerful remote server management capabilities through the built-in remote_command_execution tool that supports SSH/SFTP operations, enabling seamless server operations directly from your development environment.
Note:
remote_command_executionis a built-in tool of MyDeskBot and needs to be enabled in the tool configuration before use.
Session Usage Examples
Direct SSH Tool Usage in Chat
Users can directly request SSH operations in natural language. MyDeskBot will automatically generate and execute the corresponding tool calls:
"Please check the disk usage and service status of the production-web-01 server."
MyDeskBot will automatically understand your intent and generate a tool call like this (transparent to users):
# Auto-generated by the model, users don't need to worry about this
tools:
- name: "server-health-check"
tool: "remote_command_execution"
args:
serverName: "production-web-01"
username: "admin"
keyPath: "/path/to/private/key"
commands:
- "df -h"
- "systemctl status nginx"
- "systemctl status docker"
- "free -h"Credential Management
When your server requires authentication, you can provide credentials directly in conversation, or let MyDeskBot use your ~/.ssh/config configuration:
"Connect to production server production-server (using ~/.ssh/config) and check the web service status."
Or provide credentials directly:
"Connect to 192.168.1.100 via SSH, username is admin, private key path is ~/.ssh/id_rsa, check system status."
Recommendation: Prioritize using ~/.ssh/config for server connections to avoid repeatedly entering credentials in conversations.
Getting Started
Basic Command Execution
Simply describe your needs in natural language:
"Help me check the system load and memory usage on the web server."
MyDeskBot will automatically generate and execute the corresponding commands.
File Transfer
"Upload the deploy.sh script to the staging server and set execute permissions."
Using SSH Config
"Connect to dev-server from ~/.ssh/config and see what services are running."
Advanced Usage
System Monitoring
"Help me monitor the production server's system status, including CPU, memory, disk and network usage, and recent error logs."
Batch Deployment
"Upload the new configuration files to all web servers, then reload Nginx service, and finally verify service status."
Log Analysis
"Help me check the application logs on app-server and find any errors and warnings in the last hour."
File Backup
"Download the latest backup file from db-server, then upload it to the backup server."
Use Cases
🔐 Server Management
Manage remote servers directly using natural language:
"Restart the Nginx service on all web servers, then check service status."
📊 System Monitoring
Monitor server performance and status:
"Help me check the health status and resource usage of all nodes in the cluster."
🚀 Automated Deployment
Execute deployment and configuration management:
"Deploy the new version of code to the staging environment, run migration scripts, and verify the service is working properly."
🔍 Troubleshooting
Quickly locate and resolve issues:
"The database connection failed on the production server, help me check the database service status and logs."
📁 File Transfer
Securely transfer files:
"Upload the local configuration file to the server, then download the latest log file for analysis."
Best Practices
- Use SSH Keys: Prioritize key authentication over passwords
- Protect Sensitive Information: Use environment variables to store credentials
- Use SSH Config: Predefine server connections in
~/.ssh/config - Set Timeouts: Set appropriate timeout values for long-running commands
- Verify Commands: Verify command correctness before execution
- Limit Permissions: Use user accounts with minimum privileges for different tasks
- Reuse Connections: Enable connection reuse for better performance
Appendix: Tool Parameters Reference
The remote_command_execution tool supports the following parameters. When you describe your needs in a conversation, MyDeskBot automatically parses and generates the corresponding tool call:
| Parameter | Type | Description |
|---|---|---|
| serverName | string | Server hostname or IP address |
| username | string | SSH username |
| port | number | SSH port (default: 22) |
| password | string | SSH password (key authentication recommended) |
| keyPath | string | Path to SSH private key file (if not provided and ~/.ssh/config is configured, will use settings from config file) |
| commands | array | Array of commands to execute on the remote server |
| uploadFiles | array | Array of files to upload to the remote server |
| downloadFiles | array | Array of files to download from the remote server |
| timeout | number | Command execution timeout in seconds (default: 30) |
| captureOutput | boolean | Whether to capture and return command output (default: true) |
| maxFileSize | number | Maximum file size for operations in bytes (default: 104857600 = 100MB) |
| reuseConnection | boolean | Whether to reuse existing SSH connection (default: true) |
File Upload/Download Structure
Upload File:
uploadFiles:
- localPath: "/path/to/local/file"
remotePath: "/path/to/remote/file"
permissions: "644" # optionalDownload File:
downloadFiles:
- remotePath: "/path/to/remote/file"
localPath: "/path/to/local/file"Usage Example
When you say "Help me check the web server status", MyDeskBot automatically generates an internal call like this (this process is transparent to you):
tool: "remote_command_execution"
args:
serverName: "web-server"
username: "admin"
keyPath: "/path/to/private/key"
commands:
- "uptime"
- "df -h"
- "systemctl status nginx"