Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/utilities/c/chown.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/utilities/c/chown.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/utilities/c/chown.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/utilities/c/chown.html on line 8

chown

Change the ownership of files and directories (POSIX)

Syntax:

chown [-Rv] owner[:group] file...

Deprecated:

chown [-Rv] owner[.group] file...

Runs on:

Neutrino

Options:

-R
Recursively change ownership of files. For each file operand that names a directory, chown changes the user ID of that directory and of all files in the file hierarchy below it.
-v
Verbose. Display to stdout the operations which are being performed.
owner
A username from the user database, or a numeric userid. The chown utility changes the owner of each file to the user ID of the specified owner.
group
A group name from the user database, or a numeric groupid. The chown utility changes the group of each file to the groupid of the specified group.
file
The pathname of a file whose ownership is to be modified.

Description:

The chown utility sets each file's owner and group to the user and group IDs specified by the owner and group operands.

Examples:

Change the owner of file data to user 27:

chown 27 data

Change the owner of the file data to dtdodge:

chown dtdodge data

Change the owner of the file subfile to dtdodge and set the group of the file to techies:

chown dtdodge:techies subfile

Exit status:

0
The utility executed successfully and all requested changes were made.
>0
An error occurred.

Caveats:

If you invoke chown with the -R option, and chown attempts but fails to change the owner or group of a particular file in a specified file hierarchy, it continues to process the remaining files in the hierarchy. The chown utility can fail to change the user or group of a file if you don't have appropriate permissions.


Note: In QNX Neutrino, the _PC_CHOWN_RESTRICTED flag is enforced, therefore you must be root to use chown unless you are changing ownership to yourself. Normal users can't give a file away to another user by changing the file ownership.

For compatibility with some other implementations of chown, a deprecated syntax allows a period (.) to be used instead of a colon (:) to separate user and group (e.g. user:group and user.group are both allowed). However, be aware that if a userid contains a period, it may be specified either alone or in conjunction with a group using :, but may not be used in conjunction with a group using .. For instance, if there was a userid my.name and a group tech, you could do a chown my.name myfile or chown my.name:tech myfile, but not chown my.name.tech myfile.

See also:

chgrp, chmod, find ... -chown ...

Working with Files in the Neutrino User's Guide


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/utilities/c/chown.html on line 178

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/utilities/c/chown.html on line 178