chown - Linux command line tool to change the owner/group of a file


chown

Changes the owner or the group the file is associated with.

Usage

chown [options] owner file-list
chown [options] owner:group file-list
chown [options] :group file-list

Keep in mind that only root can change the owner of a file and only a user who belongs to the new group can change the group a file is associated with (also root can do this).

The owner is the user who will be the new owner of the file-list.
The file-list are the files or file which is going to change its owner.

Options

-c
Displays a message for each fiel whose ownership or group is changed
–dereference
Changes the ownership/group of the files symbolic links point to, not the symbolic links themselves. The default is –no-dereference.
-f
Prevents chown from displaying error messages when it is unable to change the ownership/group of a file
-R
When you include directories in the file-list this options makes all the files in that directory to be affected by the commandExamples

chown jose:contabilidad /home/account/ -R

This is going to make all files inside /home/account/ and its subdirectories to belong to jose and to be associated with the group contabilidad.

  1. No comments yet.
(will not be published)
  1. No trackbacks yet.