CtrlK
BlogDocsLog inGet started
Tessl Logo

chown

Change file owner and group. Use when adjusting file ownership, typically requires root/sudo.

67

Quality

80%

Does it follow best practices?

Impact

No eval scenarios have been run

SecuritybySnyk

Advisory

Suggest reviewing before use

Optimize this skill with Tessl

npx tessl skill review --optimize ./.flox/pkgs/skill-coreutils/skills/chown/SKILL.md
SKILL.md
Quality
Evals
Security

chown - Change File Owner and Group

Synopsis

chown [OPTION]... [OWNER][:[GROUP]] FILE...
chown [OPTION]... --reference=RFILE FILE...

Change the user and/or group ownership of each FILE.

Flags

FlagLong FormDescription
-R--recursiveOperate on files and directories recursively
-v--verboseOutput a diagnostic for every file processed
-c--changesLike -v but only report changes
-f--silent, --quietSuppress most error messages
-h--no-dereferenceAffect symlinks instead of referenced files
--dereferenceAffect the referent of each symlink (default)
--from=CURRENT_OWNER:GROUPChange only if current owner/group matches
--reference=RFILEUse RFILE's owner and group
-HWith -R, follow symlinks on command line
-LWith -R, follow all symlinks
-PWith -R, never follow symlinks (default)
--preserve-rootDon't recurse on / (default)
--no-preserve-rootAllow recursion on /
--helpDisplay help
--versionOutput version

Ownership Formats

FormatEffect
OWNERChange owner only
OWNER:GROUPChange owner and group
OWNER:Change owner, set group to owner's login group
:GROUPChange group only (same as chgrp)

Examples

# Change owner
chown user file.txt

# Change owner and group
chown user:group file.txt

# Change group only
chown :group file.txt

# Recursive ownership change
chown -R user:group dir/

# Verbose output
chown -v user:group file.txt

# Only change if current owner matches
chown --from=olduser newuser file.txt

# Copy ownership from another file
chown --reference=ref.txt target.txt

# Affect symlink itself (not target)
chown -h user:group symlink

# Change owner, set group to user's default
chown user: file.txt

Gotchas

  • chown typically requires root/sudo privileges. Regular users cannot change file ownership (this is a security feature).
  • With -R, the default -P does NOT follow symlinks, which is usually what you want to avoid accidentally changing ownership outside the target directory.
  • chown user:group is preferred over the older chown user.group form, which is ambiguous when usernames contain dots.
  • --from is useful for safe bulk changes, ensuring you only modify files with the expected current ownership.
Repository
flox/floxenvs
Last updated
Created

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.