CHOWN(8)
π CHOWN(8) β the change-owner-and-group glow-up π
okay bestie, buckle up, because this is chown from the System Manager's Manual and it's honestly iconic. This is the tool that changes who owns your files. Main character energy for file permissions, fr fr.
β¨ NAME β¨
chown β change file owner and group π«Ά
πΈ SYNOPSIS πΈ
chown [-fhnvx] [-R [-H | -L | -P]] owner[:group] file ...
chown [-fhnvx] [-R [-H | -L | -P]] :group file ...
π DESCRIPTION π
The chown utility changes the user ID and/or the group ID of the specified files. That's the whole vibe: you point it at files, you tell it who should own them, and it makes it happen. β¨
Lowkey important detail: symbolic links named by arguments are silently left unchanged unless -h is used. Silently! No warning, no drama, just π¦ nothing π¦. So if you're sitting there like "why didn't my symlink change," that's why, bestie.
The options are as follows:
-Hβ If the-Roption is specified, symbolic links on the command line are followed and hence unaffected by the command. (Symbolic links encountered during traversal are not followed.) So: links you literally typed get followed, links it finds along the way do not. Not me making that distinction π-Lβ If the-Roption is specified, all symbolic links are followed. All of them. Every last one. π-Pβ If the-Roption is specified, no symbolic links are followed. Instead, the user and/or group ID of the link itself are modified. This is the default. And for matching behavior when usingchownwithout the-Roption, the-hoption should be used instead. (iykyk β that's the gotcha paragraph.)-Rβ Change the user ID and/or the group ID of the file hierarchies rooted in the files, instead of just the files themselves. Recursive, baby. π Beware of unintentionally matching the..hard link to the parent directory when using wildcards like.*β like, that's a real "oh no" moment waiting to happen, no cap. β οΈ-fβ Do not report any failure to change file owner or group, nor modify the exit status to reflect such failures. It just... doesn't tell you. Ignorance is bliss, I guess π-hβ If the file is a symbolic link, change the user ID and/or the group ID of the link itself. The link gets the glow-up, not the thing it points at. π-nβ Interpret user ID and group ID as numeric, avoiding name lookups. Numbers only, no name-searching, we're being efficient π-vβ Causechownto be verbose, showing files as the owner is modified. And if the-vflag is specified more than once,chownwill print the filename, followed by the old and new numeric user/group ID. Double verbose = extra receipts. π§Ύ-xβ File system mount points are not traversed. Stays in its lane, respects the boundary, we love that for it. π§
Okay and here's the rules-of-the-house bit, so pay attention:
The -H, -L and -P options are ignored unless the -R option is specified. In addition, these options override each other and the command's actions are determined by the last one specified. So it's not a "combine them" situation, it's a "last one wins" situation. Periodt. π
The owner and group operands are both optional, however, one must be specified. If the group operand is specified, it must be preceded by a colon (':') character. One of them, not neither. And don't forget the colon. π«Ά
The owner may be either a numeric user ID or a user name. If a user name is also a numeric user ID, the operand is used as a user name. The group may be either a numeric group ID or a group name. If a group name is also a numeric group ID, the operand is used as a group name. Like, the names win in a tie. Noted. π
The ownership of a file may only be altered by a super-user for obvious security reasons. Similarly, only a member of a group can change a file's group ID to that group. So yeah, you can't just decide you own everything now. Sorry bestie π π
If chown receives a SIGINFO signal (see the status argument for stty(1)), then the current filename as well as the old and new file owner and group are displayed. A little progress report, mid-command. Obsessed. π‘
β EXIT STATUS β
The chown utility exits 0 on success, and >0 if an error occurs.
Zero means slay, anything bigger means something went sideways. π
π¦ COMPATIBILITY π¦
Previous versions of the chown utility used the dot ('.') character to distinguish the group name. This has been changed to be a colon (':') character so that user and group names may contain the dot character. Character development, honestly. π
On previous versions of this system, symbolic links did not have owners. Wild to think about. π°οΈ
The -v and -x options are non-standard and their use in scripts is not recommended. So like, cute for interactive vibes, not cute in your scripts. π©
π LEGACY DESCRIPTION π
In legacy mode, the -R and -RP options do not change the user ID or the group ID of symbolic links. Just so we're all clear on the legacy behavior. π§
π SEE ALSO π
chgrp(1), chmod(1), find(1), chown(2), fts(3), compat(5), symlink(7)
the whole friend group tbh π
π STANDARDS π
The chown utility is expected to be IEEE Std 1003.2 (βPOSIX.2β) compliant. Standards queen. π
π₯ HISTORY π₯
A chown utility appeared in Version 1 AT&T UNIX. an absolute OG, we stan a legend π
and that's the whole page, bestie β this one came from the Debian rendition of the chown(8) manual, dated August 24, 2022. go forth and change some owners responsibly π
π
π¦ where this page comes from
- nixpkgs unstable: file_cmds 479
- Copyright (c) 1990, 1991, 1993, 1994 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms