- set the group for directory
/data/sales
to group purchasing
.
- set all files in
/data/sales/
to the group purchasing
- set the permissions for the directory and the files to "read". The means they can not remove a file and can not change a file.
If I understood it correctly I would say ...
chgrp -R purchasing /data/sales
chmod 2750 /data/sales
chmod -R 0740 /data/sales/
- 1st one: set all files and dirs to group
purchasing
- 2nd one does the dir itself
- the 2 means files in the dir will be created with the group permissions
- 3rd one does the files inside the dir
- the -R does all files inside /data/sales/
- the 7 is read, write, execute for the owner
- the 5 means read and execute for the group. Users in the group can not delete and can not create new files. This applies to new files too.
- the 4 is read for group. So the group can view files, not alter then and not delete them.
- the 0 is no access for others
I assume owner gets full permissions and others get none. If those need to be applied too the 2nd and 4th digit in the commands need to be adjusted.
Commands also assume the one changing this has permissions to do so. If not add a sudo
in front of the lines (or use root
).