Skip to content

SSH/SFTP Tools

MyDeskBot Desktop provides seamless SSH and SFTP integration, allowing the AI assistant to interact with remote servers directly.

Features

SSH Capabilities

  • Execute remote commands
  • Run scripts on remote servers
  • Monitor server status
  • Deploy applications
  • Debug remote issues

SFTP Capabilities

  • Transfer files securely
  • Browse remote directories
  • Edit remote files
  • Manage file permissions
  • Sync local and remote directories

Setup

1. Configure SSH Connections

  1. Open MyDeskBot Desktop
  2. Go to Settings → SSH/SFTP
  3. Click "Add Server"
  4. Fill in the connection details:
    • Server address/hostname
    • Port (default: 22)
    • Username
    • Authentication method (password or SSH key)

For better security, use SSH keys:

bash
# Generate a new SSH key (if you don't have one)
ssh-keygen -t ed25519 -C "mydeskbot"

# Copy the public key to the remote server
ssh-copy-id user@remote-server.com

Then in MyDeskBot:

  1. Select "SSH Key" as authentication method
  2. Browse to your private key file
  3. If the key is password-protected, enter the passphrase

3. Test Connection

Click "Test Connection" to verify the server is accessible.

Usage Examples

Remote Command Execution

markdown
User: "Check the disk usage on the production server"

AI: [Executes SSH command]
ssh production "df -h"
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       50G   12G   36G  26% /

File Transfer

markdown
User: "Upload the new build to the server"

AI: [Transfers file via SFTP]
sftp production
put dist/build.zip /var/www/releases/

Remote Script Execution

markdown
User: "Run the database migration script on staging"

AI: [Executes script remotely]
ssh staging "cd /app && npm run migrate"

Server Monitoring

markdown
User: "Check the CPU and memory usage"

AI: [Runs monitoring commands]
ssh server "top -bn1 | head -20"

Deploy Applications

markdown
User: "Deploy the latest version to production"

AI: [Runs deployment pipeline]
ssh production "cd /app && git pull && npm install && npm run build && pm2 restart all"

AI Integration

Natural Language Operations

The AI understands high-level commands and translates them into appropriate SSH/SFTP operations:

markdown
User: "Backup the database and download the backup file"

AI: [Executes multi-step operation]

1. ssh server "pg_dump mydb > backup.sql"
2. sftp server
3. get backup.sql ./backups/

Error Handling

The AI automatically handles common issues:

  • Reconnects if connection drops
  • Retries failed operations
  • Provides clear error messages
  • Suggests fixes for common problems

Security

Connection Security

  • All connections use SSH protocol (encrypted)
  • Credentials are stored securely in your keychain
  • SSH keys are preferred over passwords

AI Safety

  • Destructive commands require explicit confirmation
  • File deletions require approval
  • The AI cannot execute commands on blacklisted servers
  • All operations are logged for audit

Best Practices

  1. Use SSH Keys: More secure than passwords
  2. Limit Permissions: Create users with minimal required permissions
  3. Use Jump Hosts: For production servers
  4. Regular Rotation: Rotate SSH keys periodically
  5. Monitor Access: Review SSH access logs regularly

Advanced Features

Custom Commands

Create shortcuts for frequently used commands:

json
{
  "sshCommands": {
    "restart-nginx": "sudo systemctl restart nginx",
    "view-logs": "sudo journalctl -u myapp -f",
    "deploy": "/opt/scripts/deploy.sh"
  }
}

File Sync

Automatically sync directories between local and remote:

markdown
User: "Sync the code directory to the server"

AI: [Runs rsync over SSH]
rsync -avz --delete ./src/ user@server:/app/src/

Multi-Server Operations

Execute the same command across multiple servers:

markdown
User: "Check nginx status on all web servers"

AI: [Iterates through servers]
web-1: nginx is running
web-2: nginx is running
web-3: nginx is not running ⚠️

Troubleshooting

Connection Refused

  • Verify server is running
  • Check SSH service is enabled
  • Ensure firewall allows SSH
  • Verify correct hostname/IP and port

Authentication Failed

  • Verify username and password
  • Check SSH key permissions (should be 600)
  • Ensure public key is in ~/.ssh/authorized_keys
  • Check for key passphrase issues

Timeout Issues

  • Check network connectivity
  • Increase timeout setting in configuration
  • Verify DNS resolution
  • Check for network latency

Permission Denied

  • Verify user has necessary permissions
  • Check sudo requirements
  • Ensure command path is in user's PATH
  • Check SELinux/AppArmor policies

Integration with Other Tools

Database Tools

Access remote databases through SSH tunneling:

markdown
User: "Connect to the production database via SSH tunnel"

AI: [Sets up tunnel and connects]
ssh -L 5432:localhost:5432 user@production

Git Integration

Deploy using git over SSH:

markdown
User: "Push the changes to the remote repository"

AI: [Executes git push over SSH]
git push origin main

Monitoring Tools

Set up automated monitoring:

markdown
User: "Monitor the server logs and alert on errors"

AI: [Sets up log monitoring]
ssh server "tail -f /var/log/app.log | grep --line-buffered ERROR"

See Also