|
| 1 | +# Managing the locked-down WSL gateway |
| 2 | + |
| 3 | +Local setup creates an app-owned WSL distro named `OpenClawGateway` by default. It is not a general-purpose Ubuntu profile: the gateway runs as the `openclaw` Linux user, Windows interop is disabled inside WSL, Windows drive automounts are disabled inside WSL, and there is no password-based `sudo` flow. |
| 4 | + |
| 5 | +Use these rules: |
| 6 | + |
| 7 | +- Run normal gateway and config commands as `openclaw`. |
| 8 | +- Run sudo-style protected-file commands as `root` from Windows with `wsl.exe --user root`. |
| 9 | +- Use double quotes around `bash -lc "..."`; single quotes do not work from Command Prompt. |
| 10 | +- Do not edit through the Windows WSL share for this locked-down config; use a WSL shell as `openclaw` instead. |
| 11 | +- Do not edit the VHD or `%LOCALAPPDATA%\OpenClawTray\wsl` storage directly. |
| 12 | + |
| 13 | +If your setup used a custom distro name, replace `OpenClawGateway` in the examples below. |
| 14 | + |
| 15 | +## Check the managed distro |
| 16 | + |
| 17 | +```powershell |
| 18 | +# Lists WSL distros and shows whether OpenClawGateway is running. |
| 19 | +wsl.exe --list --verbose |
| 20 | +
|
| 21 | +# Opens a one-shot shell as the gateway user and prints the user plus current directory. |
| 22 | +wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "whoami && pwd" |
| 23 | +
|
| 24 | +# Opens a one-shot shell as root and prints root identity details. |
| 25 | +wsl.exe -d OpenClawGateway --user root -- bash -lc "whoami && id" |
| 26 | +``` |
| 27 | + |
| 28 | +## Update `openclaw.json` |
| 29 | + |
| 30 | +Most gateway configuration lives in: |
| 31 | + |
| 32 | +```text |
| 33 | +/home/openclaw/.openclaw/openclaw.json |
| 34 | +``` |
| 35 | + |
| 36 | +Because the distro is locked down, edit this file from inside WSL as the `openclaw` user instead of editing it through the Windows filesystem share. The edit commands in this section intentionally change files; the inspection commands in the rest of this guide are read-only. |
| 37 | + |
| 38 | +1. Open a shell as the gateway user: |
| 39 | + |
| 40 | + ```powershell |
| 41 | + # Opens an interactive shell as the gateway user. |
| 42 | + wsl.exe -d OpenClawGateway --user openclaw -- bash |
| 43 | + ``` |
| 44 | + |
| 45 | +2. In that shell, back up and edit the config: |
| 46 | + |
| 47 | + ```bash |
| 48 | + # Moves into the OpenClaw config directory. |
| 49 | + cd /home/openclaw/.openclaw |
| 50 | + |
| 51 | + # Creates a backup copy before editing. |
| 52 | + cp openclaw.json openclaw.json.bak |
| 53 | + |
| 54 | + # Opens openclaw.json in the nano editor. |
| 55 | + nano openclaw.json |
| 56 | + |
| 57 | + # Verifies that openclaw.json is still valid JSON. |
| 58 | + python3 -m json.tool openclaw.json > /dev/null |
| 59 | + ``` |
| 60 | + |
| 61 | + If `nano` is not available, use `vi openclaw.json`. |
| 62 | + |
| 63 | +3. If the change does not take effect, reconnect or restart the gateway from OpenClaw Companion. |
| 64 | + |
| 65 | +Read-only checks for the config: |
| 66 | + |
| 67 | +```powershell |
| 68 | +# Shows ownership, permissions, size, and timestamp for openclaw.json. |
| 69 | +wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "ls -l /home/openclaw/.openclaw/openclaw.json" |
| 70 | +
|
| 71 | +# Verifies that openclaw.json is valid JSON without printing it. |
| 72 | +wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "python3 -m json.tool /home/openclaw/.openclaw/openclaw.json > /dev/null" |
| 73 | +
|
| 74 | +# Prints only the top-level config keys, not secret values. |
| 75 | +wsl.exe -d OpenClawGateway --user openclaw -- python3 -c "import json; data=json.load(open('/home/openclaw/.openclaw/openclaw.json')); print('\n'.join(sorted(data.keys())))" |
| 76 | +``` |
| 77 | + |
| 78 | +Do not paste or share the full `openclaw.json` file. It can contain gateway tokens, private endpoints, provider settings, or other secrets; redact those values before sharing diagnostics. |
| 79 | + |
| 80 | +## Inspect gateway state |
| 81 | + |
| 82 | +Run gateway service checks as `openclaw`: |
| 83 | + |
| 84 | +```powershell |
| 85 | +# Shows the user service status without paging; succeeds even if the service is inactive. |
| 86 | +wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "systemctl --user status openclaw-gateway.service --no-pager || true" |
| 87 | +
|
| 88 | +# Shows the most recent gateway service journal entries without paging. |
| 89 | +wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "journalctl --user-unit openclaw-gateway.service --no-pager -n 80 || true" |
| 90 | +
|
| 91 | +# Shows ownership and permissions for the app-owned gateway directories. |
| 92 | +wsl.exe -d OpenClawGateway --user openclaw -- bash -lc "ls -ld /home/openclaw/.openclaw /var/lib/openclaw /var/log/openclaw /opt/openclaw" |
| 93 | +``` |
| 94 | + |
| 95 | +Do not run `systemctl --user` as `root`; that checks root's user service manager, not the gateway's service. |
| 96 | + |
| 97 | +## Use root instead of sudo |
| 98 | + |
| 99 | +There is no interactive sudo password prompt. Open a root shell only when you intentionally need to inspect or change protected files: |
| 100 | + |
| 101 | +```powershell |
| 102 | +# Opens an interactive root shell for intentional protected-file work. |
| 103 | +wsl.exe -d OpenClawGateway --user root -- bash |
| 104 | +``` |
| 105 | + |
| 106 | +Keep gateway-owned files under `/home/openclaw/.openclaw`, `/var/lib/openclaw`, `/var/log/openclaw`, and `/opt/openclaw` owned by `openclaw:openclaw`. |
0 commit comments