chown (from English ch ange own er ) - UNIX- utility that changes the owner and / or group for the specified files. The name of the owner / group is the first argument, which is not an option. If only the user name (or numeric user ID) is specified, then this user becomes the owner of each of the specified files, and the group of these files does not change. If the name of the group (or the numeric identifier of the group) followed by a colon followed by a username, without spaces between them, the group of the file also changes. In a standard server setup, the command causes a reset of accumulated caches (touch event).
Content
- 1 Use
- 2 Usage Examples
- 3 See also
- 4 References
Usage
- chown [-cfhvR] [--dereference] [--reference = rfile] user [: group] file ...
- -c, --changes
- Describe in detail the action for each file whose owner really changes.
- -f, --silent, --quiet
- Do not give error messages for files whose owner cannot be changed.
- -h, --no-dereference
- Work with the symbolic links themselves, and not with the files they point to. This option is available only if there is a lchown system call.
- -R, --recursive
- Recursively changing the owner of directories and their contents.
- -v, --verbose
- A detailed description of the action (or lack of action) for each file.
- --dereference
- Change the owner of the file pointed to by the symbolic link instead of the symbolic link itself.
- --reference = rfile
- Change the file owner to the one that owns the file.
Use
Remember that these commands must be run as root.
- Change owner for /var/run/httpd.pid to 'root' (root is the default name for the superuser (Superuser)).
# chown root /var/run/httpd.pid
- Change the owner for strace.log to 'rob' and the group ID to 'developers'.
# chown rob: developers strace.log
- Change the owner name for / tmp and / var / tmp to ' nobody ' + change the group for / tmp and / var / tmp to ' nogroup '
# chown nobody: nogroup / tmp / var / tmp
- Change group id to newgroup for / home
# chown: newgroup / home
- Change the owner name for base to us and do it recursively, i.e. all base files ( -R ) embedded in the base directory.
# chown -R us base
- Change owner for noodlefrytasticy to mein.
# chown mein noodlefrytasticy
See also
- chmod