![]() |
![]() |
![]() |
![]() |
Change the ownership of files and directories (POSIX)
chown [-Rv] owner[:group] file...
Deprecated:
chown [-Rv] owner[.group] file...
Neutrino
The chown utility sets each file's owner and group to the user and group IDs specified by the owner and group operands.
![]() |
The maximum numeric group or user ID on a QNX 4 filesystem is 65534. |
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
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.
![]() |
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.
chgrp, chmod, find ... -chown ...
Working with Files in the Neutrino User's Guide
![]() |
![]() |
![]() |
![]() |