chown#

Synopsis#

chown $uid, $gid, @files;
chown 0, 0, '/etc/shadow';
chown -1, $gid, @files;    # -1 leaves uid unchanged

Description#

Changes the owner and group of one or more files.

Changes the owner and group of each listed file. The first argument is the numeric UID, the second is the numeric GID, and the remaining arguments are file paths. A value of -1 for either UID or GID means “don’t change that field” (converted to u32::MAX for the libc call). Uses libc::chown (follows symlinks). Returns the number of files successfully changed.

See also#

chmod, stat