Changes the owner or group associated with a file.
chown [ -f ] [ -h ] [ -R ] Owner [ :Group ] { File ... | Directory ... }
The chown command changes the owner of the file specified by the File parameter to the user specified by the Owner parameter. The value of the Owner parameter can be a user ID or a login name found in the /etc/passwd file. Optionally, a group can also be specified. The value of the Group parameter can be a group ID or a group name found in the /etc/group file.
Only the root user can change the owner of a file. You can change the group of a file only if you are a root user or if you own the file. If you own the file but are not a root user, you can change the group only to a group of which you are a member.
When a symbolic link is encountered and you have not specified the -h flag, the chown command changes the ownership of the file or directory pointed to by the link and not the ownership of the link itself.
If you specify the -h flag, the chown command has the opposite effect and changes the ownership of the link itself and not that of the file or directory pointed to by the link.
If you specify the -R flag, the chown command recursively descends the specified directories.
If you specify both the -h flag and the -R flag, the chown command descends the specified directories recursively, and when a symbolic link is encountered, the ownership of the link itself is changed and not that of the file or directory pointed to by the link.
Access Control: This program should be installed as a normal user program in the Trusted Computing Base.
This command returns the following exit values:
0 | The command executed successfully and all requested changes were made. |
>0 | An error occurred. |
chown jim program.cThe user access permissions for program.c now apply to jim. As the owner, jim can use the chmod command to permit or deny other users access to program.c.
chown -R john:build /tmp/src
/usr/bin/chown | The chown command |
/etc/group | File that contains group IDs |
/etc/passwd | File that contains user IDs |
The chgrp command, chmod command.
The chown subroutine, fchown subroutine.
The File Ownership and User Groups in AIX Version 4.3 System User's Guide: Operating System and Devices introduces file ownership and permissions to access files and directories.
The Security Administration in AIX Version 4.3 System Management Guide: Operating System and Devices describes system security.