ssh_execute_sudo
Execute remote commands with sudo privileges, handle passwords securely, and return exit code and output. Supports working directory and timeout.
Instructions
Runs a command with elevated privileges via sudo on the named server and returns the exit code and output. Prepends sudo when absent. If a password is given, or a sudo password is configured for the server, it is piped to sudo -S and masked in the returned output. Mutates remote state and can be destructive. Honors the cwd parameter or the server default directory and adapts to Linux or Windows. Timeout defaults to 30000 ms. Blocked entirely in readonly mode; in restricted mode the command must satisfy the allow and deny patterns.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory | |
| server | Yes | Server name or alias | |
| command | Yes | Command to execute with sudo | |
| timeout | No | Command timeout in milliseconds (default: 30000) | |
| password | No | Sudo password (will be masked in output) |