Last active
December 21, 2015 19:18
-
-
Save malias/d7c1f3146023163f11bd to your computer and use it in GitHub Desktop.
With this script, u can change permissions with a default value (files=644 & directories=755). Change the path to ur directory and start the script from ur console or cronjob
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 | |
# | |
# | |
## Der PATH muss angepasst werden | |
## Für die Webseite kann z.b. /home/[BENUTZERNAME]/public_html/ | |
## Bsp: Path='/home/oliveror/public_html/' | |
Path='/home/[BENUTZERNAME]/[PFAD]/' | |
function setChmod { | |
ls -1 "$1" | while read file | |
do | |
file="${1}/${file}" | |
if [[ -f "$file" ]] && [[ `stat -c %a "$file"` != 644 ]] | |
then | |
chmod -v 644 "$file" | |
elif [[ -d "$file" ]] | |
then | |
chmod -v 755 "$file" | |
setChmod "$file" | |
fi | |
done | |
} | |
setChmod $Path | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment