|Front | Info | Lists | Newsfeeds | Study Guide | What is BSD?|
This is the BSDA Study Guide Book written via a wiki collaboration. This is a work in progress. You may contribute to or discuss this specific page at http://bsdwiki.reedmedia.net/wiki/Modify_a_file__39__s_owner_or_group.html.
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
Obviously changing a file's ownership can affect who can access to that file; thus the su(1) 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):
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.)
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)