Created
September 13, 2018 09:53
-
-
Save Ibekr/fdf6cd1ba0b4d9fcf7c0cb4bfd5b2960 to your computer and use it in GitHub Desktop.
Revisions
-
Ibekr revised this gist
Sep 13, 2018 . No changes.There are no files selected for viewing
-
Ibekr created this gist
Sep 13, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ # webmode A simple script to set up user and group permissions for webserver's directories (and all sub directories). Gives permissions: * **760** (- rwx rw- ---) for all files in directory and subdirectories * **770** (d rwx rwx ---) for directory and all subdirectories recursively As a default, it gives permissions to **www-data** user and **www-data** group. An example of use: ~~~~ webmode.sh /var/www/example.com/ ~~~~ Repo: https://github.com/Ibekr/webmode/blob/master/README.md 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #!/bin/bash if [ "$1" == "" ]; then echo 'parameter is empty. Example: webmod.sh /var/www/' 1>&2 exit 1 fi # Make sure only root can run this script if [ "$(id -u)" != "0" ]; then echo "This script must be run as root" 1>&2 exit 1 fi chown -R www-data:www-data "$1" chmod u=rwx,g=rw,o= -R "$1" find "$1" -type d -exec chmod g+x {} \;