exits for each file and directory stored on the HOME or WORK file systems:
Each user ID is member of one or more groups. Group memberships can be checked with the groups
command.
blogin4:~ $ groups myaccount myaccount prj00012 |
You can change the group ownership of a file:
blogin4:~ $ chgrp prj00012 somefile.txt blogin4:~ $ ls -l somefile.txt -rw------- 1 myaccount prj00012 237271040 Jul 3 2020 somefile.txt |
To change all small number of files in a directory recursively, use "chgrp -R".
blogin4:~ $ find somedirectory | xargs chgrp prj00012 blogin4:~ $ ls -ld somedirectory drwx------ 1 myaccount prj00012 4096 Jul 3 2020 somedirectory |
Once a file (or a complete directory) has the group ownership, the file might be accessed by all users in the group.
blogin4:~ $ ls -l somefile.txt -rw------- 1 myaccount prj00012 237271040 Jul 3 2020 somefile.txt blogin4:~ $ chmod g+r somefile.txt blogin4:~ $ ls -l somefile.txt -rw-r----- 1 myaccount prj00012 237271040 Jul 3 2020 somefile.txt |
blogin4:~ $ ls -ld somedirectory drwx------ 1 myaccount prj00012 4096 Jul 3 2020 somedirectory blogin4:~ $ find somedirectory |xargs chmod g+rX blogin4:~ $ ls -ld somedirectory drwxr-x--- 1 myaccount prj00012 4096 Jul 3 2020 somedirectory |
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.