Modify a file's owner or group
Be able to modify a file's ownership as required. In addition, be aware of the importance of verifying one's own identity before creating files.
A file's ownership can be changed by using the
The change ownership tool can be used to change a file's user ID
by using a username or user ID as an argument.
A filename (or filenames) is the final argument.
Obviously changing a file's ownership can affect who can access to that file; thus the su(1) (((file ownership!su))) substitute user identity tool, can be used to gain access to file, which might otherwise be prevented due to the file's ownership.
The following example shows the current ownership of a file and then changes it to another user (by using a symbolic name and not a numeric ID):
""$ ls -l math2.pl -rwxr-xr-x 1 reed wheel 734 Feb 14 2006 math2.pl
""$ chown austin math2.pl
""$ ls -l math2.pl -rwxr-xr-x 1 austin wheel 734 Feb 14 2006 math2.pl
The user ID can only be changed by the superuser (root), because a normal user should not be able to hide their data or bypass file system quotas by changing ownership. (TODO: any other reasons?) A file's group ID can be changed by any user to a group that they are a member of. (See section Determine identity and group membership about group membership.)
chown utility can also change the file's group ID by prefixing a group name or group ID with a colon (:).
TODO: show example using numeric ID instead of symbolic name and ls -l -n
TODO: show example of using chown to change group
TODO: -R switch
TODO: point to section about file ownership attributes
TODO: document chgrp and show example
TODO: from concept" "In addition, be aware of the importance of verifying one's own identity before creating files."
TODO: after mentioning -R, mention mtree can be used to reset file onwerships based on a specification. show brief example maybe? or point to other section?
chown(8), chgrp(1); su(1), mtree(8)