Linux chown Command: Change File Owner and Group
chown changes the owner user and owner group of a file or directory. It is useful when aligning the ownership of service data directories, but incorrect recursive application can block service access.
What is the chown command?
Specifying owner:group changes both attributes together, and specifying only the owner usually leaves the group unchanged. Permissions to change are limited according to system policy and generally require administrative privileges. The access permission bits themselves are managed with chmod.
Basic syntax
chown [options] owner[:group] file...
Installed implementations and options may vary by distribution. Check the description for the current system with man chown.
Examples
Change owner only
Set the file owner according to the account. For important system paths, verify the target first.
sudo chown alice report.txt
Change both owner and group
Specify user and group to reduce ambiguity.
sudo chown alice:editors report.txt
Check change results
Check the owner and group and change only if necessary.
stat -c '%U:%G %n' report.txt
Checking the result of owner and group change
The following example assumes that the alice user and the developers group actually exist. Changing ownership usually requires administrator privileges.
sudo chown alice:developers demo.txt stat -c '%U:%G %n' demo.txt
Example output:
alice:developers demo.txt
When chown is successful, there is usually no output, so check the result with stat or ls -l. -R applies to the entire directory below, so make sure to check the path and how symbolic links are handled before using it on a web root or system directory. Changing ownership can alter service access policies.
In containers and network filesystems, the same account name can map to different numeric UIDs or GIDs. For automation, compare id user with the target's stat -c '%u:%g' output. Arbitrary ownership changes to service files can break the service's ability to read, write, or execute them.
Main Options and Format
| Options/Format | Description |
|---|---|
-R |
Recursively change ownership of subitems. |
-h |
Target the symbolic link itself instead of the link's target. |
--reference=file |
Copy the owner and group of the referenced file. |
-v |
Show detailed information on processed files. |
Precautions when using
Incorrectly specifying a single path in chown -R can change ownership of many files at once. First, check the scope with stat or find, and if possible, apply only to a narrow path. Handling symbolic links and special permission bits may be affected by the file system and options.
Frequently Asked Questions
What is the difference between chown alice report.txt and chown alice:editors report.txt?
The first changes only the owner, while the second specifies both the owner and the group.
Official Documentation
The exact behavior of the options and differences between implementations can be found in the official chown documentation.









