1.7. chown and chgrp
When you create a file it is owned by the creator. Once you own a file, you can then change the ownership and give it to another user, so long as this is a valid user who has an entry in /etc/passwd. This can be in the form of the actual login name of the user or the user ID, which is a number. When you change ownership of a file, the suid bit is cleared for security reasons. Only the system administrator or the actual owner of the file may give the file away to another user. If you change the owner of the file you cannot claim it back. If you want it back, go and talk to your system admin.
Here’s the general format:
chown –R –h owner file
The -R means you can do a recursive change on your files throughout your sub-directories ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access