files/chown
Change file or directory owner and group to manage access permissions. Requires root privileges for ownership changes; symlinks are never followed.
Instructions
Changes a file's or directory's owner and/or group (chown). Mutating and idempotent; for permission bits use files/chmod, 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. Changing the owner requires privileged: true (a grant, and a paths: entry for root). owner is user, user:group, :group or user: (the user's login group), with names or numeric ids; names are looked up in the host's /etc/passwd and /etc/group and an unknown one fails (no such user). Returns PATH: old -> new as owner:group, or unchanged; a recursive run prints one line per changed entry then a summary with skipped symlinks and per-entry errors, and is not atomic.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path | |
| owner | Yes | user, user:group, :group, or user: (the user's login group); names or numeric ids | |
| recursive | No | Also apply to everything below a directory (symlinks are skipped, never followed) | |
| privileged | No | Run as root - required to change ownership. Needs a grant for this tool in mcp-sudo.yaml and a `paths:` entry covering the path |