Simple definition
chown is a Unix/Linux command that changes the owner and, when requested, the group associated with a file or directory.
Technical definition
POSIX files are associated with an owner UID and a group GID. chown can modify those identifiers using names or numeric values. The -R option applies the change recursively to a directory tree and can therefore have a broad impact. Required privileges depend on the requested change and operating system.
How it works / role
Its role is to define or correct file ownership. Ownership is different from the permission bits changed by chmod; both mechanisms work together to determine access.
What is it used for?
Assign files to a service account, correct ownership after a copy or restore, or restore the ownership expected by an application.
Practical example
chown www-data:www-data /var/www/site assigns the directory to the web-service user and group. Adding -R would apply the same ownership change to its contents.
Common issues
- Using -R on the wrong path
- Ownership is corrected but chmod permissions are still wrong
- Files are assigned to the web account although they should remain administrative
- Confusion between owner, group, and permission bits
Related terms
Key takeaway: Before running a recursive chown, verify both the path and expected ownership; a valid command on the wrong tree can break an application.