files/chmod
Change file or directory permission bits using octal or symbolic modes. Supports recursive changes, skips symlinks, and requires privilege for files you don't own.
Instructions
Changes a file's or directory's permission bits (chmod). Mutating and idempotent; for owner or group use files/chown, to check the result files/list. Never follows symbolic links: a path containing a symlink in any component is refused, and recursive changes skip symlinks and report them. Numeric modes follow GNU chmod semantics (on directories a 4-digit mode keeps setuid/setgid; use 5 digits, e.g. 00755, to set them exactly); a bare 755 is octal. Changing a file you do not own needs privileged: true (a grant, and a paths: entry for root). Single change returns PATH: 0644 (-rw-r--r--) -> 0755 (-rwxr-xr-x), or ... unchanged if already set. A recursive run prints one line per changed entry, then changed N, unchanged M (plus skipped symlinks) and per-entry errors; it is not atomic, so partial success is possible.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | Octal (644, 0755, 4755) or symbolic (u+x, go-w, a=r, +X, u+s, +t; comma-separated) | |
| path | Yes | Absolute path | |
| recursive | No | Also apply to everything below a directory (symlinks are skipped, never followed) | |
| privileged | No | Run as root - needed for files you don't own. Needs a grant for this tool in mcp-sudo.yaml and a `paths:` entry covering the path |