Last active
November 2, 2020 09:37
-
-
Save muratgozel/e260aadd5695e802f23ca6510a972e74 to your computer and use it in GitHub Desktop.
Configure existing and future file and folder user and group permissions recursively in linux.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SAMPLE_DIR=/mnt/some-volume | |
# change ownership of the directory and all of its contents | |
chown -R cmsman:cmsteam $SAMPLE_DIR | |
# change permissions of the directory and all of its contents | |
chmod -R u=rwX,g=rwX,o-rwx $SAMPLE_DIR | |
# set uid and gid | |
chmod -R u+s $SAMPLE_DIR | |
chmod -R g+s $SAMPLE_DIR | |
# set acl for the folder and all of its contents | |
setfacl -R -m user:www-data:rwx $SAMPLE_DIR | |
setfacl -R -m user:cmsman:rwx -m group:cmsteam:rwx $SAMPLE_DIR | |
setfacl -R -m default:user:cmsman:rwx -m default:group:cmsteam:rwx $SAMPLE_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment