BSD syscall#15
svc · unix #15
chmod
Changes the permission bits of a file referenced by path.
Prototype
int chmod(user_addr_t path, int mode);Returns: int
Arguments
| Name | Type | Dir | Description |
|---|---|---|---|
| path | user_addr_t | - | |
| mode | int | - |
Version history
| XNU tag | macOS | # |
|---|---|---|
| xnu-1456.1.26 | macOS 10.6 Snow Leopard | 15 |
| xnu-1486.2.11 | — | 15 |
| xnu-1504.15.3 | — | 15 |
| xnu-1504.3.12 | — | 15 |
| xnu-1504.7.4 | — | 15 |
| xnu-1504.9.17 | — | 15 |
| xnu-1504.9.26 | — | 15 |
| xnu-1504.9.37 | — | 15 |
Notes
Only the file owner or a privileged process may change mode bits. ACLs configured via chmod +a or the acl_*(3) API take precedence over the mode bits. SIP-protected files reject mode changes even from root.
Detection
ES emits ES_EVENT_TYPE_NOTIFY_SETMODE with the new mode. syscall::chmod:entry in DTrace.
Related APIs
fchmodfchmodatchownstatacl_set_file