Skip to main content
Kill -9 Club
Sign in

chown

FilesPackage: coreutilsHandle with care

Changes a file's owner and group. A service that "cannot write" to its own directory has almost always a missing chown after a copy made by root.

A mistake with this command can destroy data or lock you out

  • A chown -R on /, /etc or /usr breaks the machine: sudo refuses to work the moment /etc/sudoers is no longer root's. Check the target with ls -ld first, and beware an empty variable in the path.

What its options do in the lessons

From the same glossary the lessons render under their commands, so the two cannot disagree.

chown -R
Applies recursively to subdirectories.
chown --reference
Takes the owner and the group from another file instead of an OWNER:GROUP argument. The counterpart to chmod --reference: a temporary file created by root picks up the account that owned the target.

Lessons that teach it