Skip to content
Contents
GuidesOpenWrt

Why does OpenWrt deny ubus file read when SSH can read the file?

The same terminal can return ok and then Permission denied for one file. Compare a local call with an anonymous session before changing ownership or web permissions.

The same terminal can return ok and then Permission denied for one file. Compare a local call with an anonymous session before changing ownership or web permissions.

Check the method first

Connect over SSH on the management network. Check your identity and look for read under file. If absent, check the firmware’s file module. A root shell tells you nothing about the browser role.

id
ubus -v list file

Read one harmless file twice

Run the whole block in an ordinary interactive shell. The second call supplies the all-zero anonymous session. Leave it unchanged and keep login tokens private. The last commands remove the temporary file.

(
  f=$(mktemp /tmp/gm-read.XXXXXX) || exit 1
  printf 'ok\n' > "$f"
  ls -ln "$f"
  cat "$f"
  ubus call file read "{\"path\":\"$f\"}"
  ubus call file read "{\"path\":\"$f\",\"ubus_rpc_session\":\"00000000000000000000000000000000\"}"
  rm "$f"
  unset f
)

SSH · OpenWrt 25.12.6 · file.read · ok / Permission denied

This SSH capture comes from an OpenWrt 25.12.6 x86/64 VM. Ownership and mode stayed fixed. Anonymous denial was expected here. If both calls succeed, review anonymous grants before testing anything sensitive. This does not establish an ownership bug in older builds.

Follow the first failure

If cat fails, check the target, symlinks, owner, group and traversal of each parent directory. If only local RPC fails, check the service identity, file type and size limits. On older builds such as 21.02.0 record the rpcd revision. Test ownership changes only on an isolated copy with the mode held constant.

If only the browser fails, sign in again. Check permission to invoke file.read and file-scope read access to the exact path. Grant only what the role needs. Verify an allowed harmless file opens and an unauthorized account still gets denied. Revert ineffective changes and sign in again. Avoid directory-wide grants.

How to keep custom rpcd ACLs across an OpenWrt upgrade

Explore hardware

Comments