Zugriffsrechte auf Dateisystemebene
-
Hallo,
ich habe eine Frage zu den Zugriffsrechten auf Dateisystemebene für Installationen auf Linux. Im idoit-rights.sh-script werden, abweichend von den Empfehlungen in der Knowledgebase, zusätzl. rekursiv 777-Rechte für eine ganze Reihe von Ordnern und Dateien vergeben. Das sollte doch nicht nötig sein, wenn als Datei-Eigentümer der Apache-User gesetzt ist, oder? Mindestens die src/config.inc.php enthält bei uns das DB-Passwort im Klartext.
Übersehe ich etwas, oder sollte das Skript nicht lieber gefixed werden, um nicht configs world-readable zu haben?
Als Standard-Rechte sieht das skript 644 für Dateien und 775 für Ordner vor; gibt es bekannte Probleme, wenn ich restriktiver 600 für dateien und 700 für Ordner setze (mit Apache-user als Eigentümer)?
Auszug aus idoit-rights.sh:
echo "[*] Setting up temp rights" $SU_CMD chmod -R 777 temp \ src/themes/default/smarty/templates_c \ src/themes/default/smarty/cache \ src/ \ updates/versions \ src/config.inc.php \ imports/ \ upload/files \ upload/images Danke! -
Bei uns hat dieses Vorgehen bislang noch nicht zu Problemen geführt. Anstelle von idoit-rights.sh setzen wir unter Debian das folgende Skript ein:
#!/bin/bash set -euo pipefail PATH=/bin:/usr/bin OWNER=www-data function pre_update { find "$BASEDIR" -not -user "$OWNER" -print0 | xargs -0 -r chown "$OWNER:$OWNER" find "$BASEDIR" -type d -print0 | xargs -0 -r chmod 775 find "$BASEDIR" -type f -print0 | xargs -0 -r chmod 660 } function post_update { find "$BASEDIR" -not -user "$OWNER" -print0 | xargs -0 -r chown "$OWNER:$OWNER" chmod +x "$BASEDIR/controller" "$BASEDIR/import" "$BASEDIR/tenants" "$BASEDIR/updatecheck" chmod +x "$BASEDIR"/imports/scripts/*.sh for WDIR in "$BASEDIR/temp" "$BASEDIR/src/themes/default/smarty/templates_c" ; do if [ -d "$WDIR" ] ; then find "$WDIR" -type f -print0 | xargs -0 -r rm fi done } function usage { cat << EOF Set file and directory rights and ownership before and after updates. Usage: update_actions.sh pre_update DIR update_actions.sh post_update DIR EOF } function check_base_dir { BASEDIR=$1 if [ -z "$((head -1 "$BASEDIR/VERSION" | fgrep i-doit) 2> /dev/null)" ] ; then echo -e "Error checking base directory: Expecting to find VERSION file containing \n'i-doit' in the first line.\n" usage exit 1 fi } #main if [ "$EUID" != 0 ] ; then echo "This script is supposed to be run with root privileges" exit 1 fi if [ -z "$1" ]; then usage exit 1 fi if [ "$1" = "pre_update" ]; then check_base_dir "$2" pre_update elif [ "$1" = "post_update" ] ; then check_base_dir "$2" post_update else echo 'Unknown command' $1 usage exit 1 fiDebian erzeugt per default für jeden User eine eigene Gruppe (user private group), dort macht es keinen Unterschied ob man 660 oder 600 verwendet.
-
Das i-doit rights Script ist sicherlich etwas großzügig mit den Rechten. Grundsätzlich theoretisch können die Rechte auch alle mit der Ownership des Apache Users auf rwx–---- und ähnliche Kombinationen (nicht überall sind Schreibrechte erforderlich) gesetzt werden. Anderweitige Zugriffsrechte benötigen höchstens externe Cronjobs.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login