O'Reilly logo

Linux in a Nutshell, 6th Edition by Robert Love, Stephen Figgins, Ellen Siever, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

chown

Synopsis

chown [options] newowner files
chown [options] --reference=filename files

Change the ownership of one or more files to newowner. newowner is either a user ID number or a login name located in /etc/passwd. chown also accepts users in the form newowner:newgroup or newowner.newgroup. The last two forms change the group ownership as well. If no owner is specified, the owner is unchanged. With a period or colon but no group, the group is changed to that of the new owner. Only the current owner of a file or a privileged user may change the owner.

Options

-c, --changes

Print information about files that are changed.

--dereference

Follow symbolic links.

-f, --silent, --quiet

Do not print error messages about files that cannot be changed.

--from=currown:currgroup

Only change owner and/or group if the current owner and group match those specified in --from. If currown or currgroup is omitted, a match is not required for that attribute.

-h, --no-dereference

Change the ownership of each symbolic link (on systems that allow it), rather than the referenced file.

-v, --verbose

Print information about all files that chown attempts to change, whether or not they are actually changed.

-R, --recursive

Traverse subdirectories recursively, applying changes.

-H

With -R, traverse symbolic link to a directory.

-L

With -R, traverse every symbolic link that leads to a directory.

-P

With -R, do not traverse any symbolic links. This is the default.

--reference=filename

Change owner to the owner of filename instead ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required