The chown and chgrp commands allow you to change the owner or the group of a file, respectively.
The chown command lets you change the owner of a file. Only the superuser can change the owner of a file under most modern versions of Unix.
The chown command has the form:
chown [ -fRh ]
The -f and -R options are interpreted exactly as they are for the chmod and chgrp commands, if supported. The -h option is a bit different from that of chmod. Under chown, the option specifies that the owner of the link itself is changed and not what the link points to.
Other entries have the following meanings:
The file’s new owner; specify the owner by name or by decimal UID
The list of files whose owner you are changing
In earlier versions of Unix, all users could run the chown command to change the ownership of a file that they owned to that of any other user on the system. This lets them “give away” a file. The feature made sharing files back and forth possible, and allowed a user to turn over project directories to someone else.
Allowing users to give away files can be a security problem because it makes a miscreant’s job of hiding his tracks much easier. If someone has acquired stolen information or is running programs that are trying to break computer security, that person can simply change the ownership of the files to that of another user. If he sets the permissions correctly, he ...