chown assigns a new owner to a file or a directory.
Only the POSIX administrator may change the owner of a file.
Syntax
chown[ -h][ -R] uid[:gid] file ... |
If file is a symbolic link, chown changes the owner of the symbolic link. Without this option, the owner of the file referenced by the symbolic link is changed.
(recursive)
Login name or user ID of the new owner. Optionally, the group ID may also be specified.
Name of the file that is to have a new owner. Directories and multiple file names are also allowed. |
Error
|
Locale
The following environment variables affect the execution of chown: LANG Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined. LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments). LC_CTYPE governs character classes, character conversion (shifting) and the behavior of character classes in regular expressions. LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES. |
Example
You are working as the POSIX administrator and want to change the owner of a file. You wish to assign the new owner MARK to the file text1 whose owner is CATHY. To do this, enter:
|
See also
chgrp, chmod chown() [4] |