run_privileged_command
Run bash commands with root privileges in a WSL distribution for system administration tasks requiring elevated permissions, such as installing packages or editing configuration files.
Instructions
⚠️ ELEVATED — runs as root (via wsl.exe --user root). IMPORTANT: Before calling this tool you MUST show the user the exact command that will be executed and ask for explicit confirmation. Only call it once the user has confirmed. Use this instead of sudo — do not include 'sudo' in the command string. Examples of operations that require this tool: apt install, systemctl, editing /etc files, chown/chmod on system paths, mounting filesystems.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| distro | No | Name of the WSL distribution. Defaults to the system default distribution. | |
| reason | No | Brief explanation of why root access is needed, shown alongside the confirmation prompt. E.g. 'install nginx via apt' or 'edit /etc/hosts'. | |
| command | Yes | The bash command to run as root (passed to `bash -c`). Do not prefix with 'sudo' — the command already runs as root. | |
| timeout_ms | No | Maximum execution time in milliseconds. Defaults to 30000 (30 seconds). |