ssh_execute_sudo
Runs a command with sudo on a specified server, handling password input and masking it in the output. Returns exit code and output.
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 |
|---|---|---|---|
| server | Yes | Server name or alias | |
| command | Yes | Command to execute with sudo | |
| password | No | Sudo password (will be masked in output) | |
| cwd | No | Working directory | |
| timeout | No | Command timeout in milliseconds (default: 30000) |