Why is the chown
command root-only?
Why can't non-root users use chown to give away files they own?
Why can’t a normal user `chown` a file
chownnot-root-userpermissions
chownnot-root-userpermissions
Why is the chown
command root-only?
Why can't non-root users use chown to give away files they own?
Best Answer
Most unix systems prevent users from “giving away” files, that is, users may only run
chown
if they have the target user and group privileges. Since usingchown
requires owning the file or being root (users can never appropriate other users' files), only root can runchown
to change a file's owner to another user.The reason for this restriction is that giving away a file to another user can allow bad things to happen in uncommon, but still important situations. For example:
chown
to make that file owned by another user Bill. The file would then count under Bill's disk quota even though only Alice can use the file.