Using chgrpAlthough you can't change a file's owner, you can change the group that a file belongs to. You can do this with the chgrp command. chgrp is a Unix command used to change the group setting. The chgrp command stands for "change group." The chgrp command marks a file as being part of a different group. To do this, however, you must be a member of that group. Your Unix system administrator has the capability to create new groups and add users to these groups. If you have any questions about your own group membership(s), ask your administrator how your account was configured. To use chgrp, follow these steps:
For example, type the following: >chgrp admins script.sh >ls -lg script.sh -rwxr-xr-x 1 rob admins 1463882 Dec 25 12:00 (output removed) The script.sh file now belongs to the group admins. Members of the group have read and execute permissions for the file. The most obvious use for chgrp is if you are collaborating on a project. If you create a file that you want to share with many people, you'll need to change the group of the file to one that all the users belong to.
|