chown
Change user owner and group ownership of files and directories.
Common Options & Flags
| Option / Flag | Description |
|---|---|
| -R, --recursive | Operate on files and directories recursively |
| -v, --verbose | Output a diagnostic for every file processed |
| --from=CURRENT_OWNER | Change ownership only if current owner matches |
Practical Command Examples
Changes owner and group to www-data.
Recursively assigns owner deploy and group developers.
Production Real-World Use Case
Assigning directory permissions to system daemons after copying build output to web servers.
Common Mistakes
- ✕Forgetting the colon between owner and group (e.g. user group vs user:group).
Security Considerations
Ensure background daemon users (nginx, postgres) own only necessary service paths.