From 268b31685da65b665fbd159c949e6b3291813bd1 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Thu, 28 Jul 2022 13:20:49 -0400 Subject: [PATCH] Ensure STORAGE_ROOT has a+rx permission since processes run by different system users need to access files within it --- setup/start.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup/start.sh b/setup/start.sh index bd743ac..0626ab0 100755 --- a/setup/start.sh +++ b/setup/start.sh @@ -67,6 +67,10 @@ fi fi # Create the STORAGE_USER and STORAGE_ROOT directory if they don't already exist. +# +# Set the directory and all of its parent directories' permissions to world +# readable since it holds files owned by different processes. +# # If the STORAGE_ROOT is missing the mailinabox.version file that lists a # migration (schema) number for the files stored there, assume this is a fresh # installation to that directory and write the file to contain the current @@ -77,6 +81,8 @@ fi if [ ! -d $STORAGE_ROOT ]; then mkdir -p $STORAGE_ROOT fi +f=$STORAGE_ROOT +while [[ $f != / ]]; do chmod a+rx "$f"; f=$(dirname "$f"); done; if [ ! -f $STORAGE_ROOT/mailinabox.version ]; then setup/migrate.py --current > $STORAGE_ROOT/mailinabox.version chown $STORAGE_USER.$STORAGE_USER $STORAGE_ROOT/mailinabox.version