chown Change file owner and group
Changes which user and group own a file or folder. You use it when files end up owned by the wrong account, for example after copying them with sudo or restoring a backup. Most changes need super user rights, so it is usually run with sudo.
Synopsis
chown [-fhnvx] [-R [-H | -L | -P]] owner[:group] file ...
chown [-fhnvx] [-R [-H | -L | -P]] :group file ...
Common options
| Option or form | What it does |
|---|---|
-R | Change a folder and everything inside it. Use with care |
-h | If the target is a symbolic link, change the link itself instead of the file it points to |
-v | Verbose: show each file as its owner is changed. Repeat it (-vv) for old and new numeric IDs |
-f | Do not report failures, and do not reflect them in the exit status |
-n | Treat the owner and group as numeric IDs and skip name lookups |
-H, -L, -P | With -R, choose how symbolic links are treated: -H follows links named on the command line, -L follows all links, -P follows none (the default) |
-x | With -R, do not cross into other mounted file systems |
Examples
sudo chown alice report.pdf
sudo chown alice:staff report.pdf
sudo chown :staff report.pdf
sudo chown -R "$USER" ~/projects/myapp
sudo chown -v alice:staff report.pdf
Notes
- You cannot give a file away without super user rights. An ordinary user can only change the group of their own files, and only to a group they belong to. That is why most examples use sudo.
- chown -R can quietly damage a system if it points at the wrong place. Check the path twice, never aim it at /, /usr, /etc or a bare *, and be careful with patterns like .*, which also match the parent folder (..).
- If you use a variable such as "$DIR", quote it and check it is not empty, or the command may act on a different path than you intended. Use a colon between owner and group (alice:staff).
- To change permissions (read, write, execute) rather than ownership, use chmod. The two are separate: owner and group decide whose permission bits apply.
See also
Last reviewed 2026-10-07.