CHOWN(1B)

πŸ“¦ version 070715, in nixos 26.05, nixpkgs unstable

✨ CHOWN(1B) ✨

Hey bestie, welcome to the CHOWN(1B) glow-up πŸ’…βœ¨ β€” yes, it's the BSD System Compatibility version, and yes, we're gonna get into it.


🌸 NAME 🌸

chown β€” (BSD) change file ownwer 😭 (ok so the original literally spells it "ownwer" and I'm not fixing it because DETAILS, but just know it's giving "owner" energy, fr fr)


πŸŽ€ SYNOPSIS πŸŽ€

/ucb/chown [-fhHLPR] owner[.group] file ...

πŸ’– DESCRIPTION πŸ’–

Okay so picture this: chown changes the owner of the files to owner, and if group is also there? It changes the group-ID of the files to group. Slay. 🫢

And here's the tea: both owner and group can be either a decimal UID / GID or a login / group name that's found in the password file. iykyk.

The following options are accepted:

  • -f β€” bestie said "no negativity" β€” do not display errors πŸ™ˆ
  • -h β€” when a symbolic link is encountered, change the owner and group of the link itself, not the file it refers to. main character energy, focusing on the link not the destination πŸ’…
  • -R β€” recursively descend into each file operand. Whether owner and group of a symbolic link are changed depends on the -h option, but the link is not followed otherwise. it's giving "respect the link's boundaries" ✨

🌈 The POSIX.1-2001 options (yes they're iconic, no we're not skipping them) 🌈

  • -H β€” with the -R option, if a symbolic link given on the command line points to a directory, follow that symbolic link and change owner and group in the files below, but do not handle any other symbolic links specially. so like, only the command-line link gets the special treatment, periodt. πŸ‘‘
  • -L β€” with the -R option, whenever a symbolic link is encountered that points to a directory, follow the symbolic link and change owner and group in the files below. it's giving "follow every directory link you see" energy πŸ”₯
  • -P β€” with the -R option, do not follow any symbolic links, but change owner and group of the links themselves. no chasing, just respecting the link as-is, ngl that's valid πŸ¦‹

πŸ“ FILES πŸ“

  • /etc/passwd
  • /etc/group

these are the files, bestie β€” the sources of truth for all your user and group name needs πŸ’œ


⭐ SEE ALSO ⭐

chown(2), passwd(5), group(5)

go read those if you wanna go deeper, iykyk 🌸


πŸ’€ NOTES πŸ’€

Okay so permission to change owner and group? It's based on either:

  • historical System V behaviour β€” which is to allow the owner of the file or a privileged user to change to any value (wild, I know 😭), or
  • historical BSD behaviour β€” which is to restrict changing the owner to a privileged user and changing the group to a group to which the file owner belongs (more chill, more rules, still iconic)

so yeah, it depends on the vibe of your system, fr fr. πŸ™ˆ


πŸ’… That's the whole page, bestie. No cap, every option, file, and note is here. Go change some owners and slay. ✨

This page is brought to you by the Heirloom Toolchest, dated 1/29/05 β€” vintage but still iconic πŸŽ€πŸ’–

πŸ“¦ where this page comes from