Skip to content

Commit

Permalink
run php as root so we can write files whatever the perms
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Jan 8, 2024
1 parent 66fd02a commit 5cbf3e9
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions file-manager/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ then
cp ../index.php index.php
cp ../config.php config.php
cp ../manager_auth.php manager_auth.php
ln -s manager_auth.php auth.php
# rewrite conf in /admin/ faking
if [[ "$APP_URL" != "" ]]
then
ADMIN_APP_URL="${APP_URL}/admin/"
fi
APP_URL="$ADMIN_APP_URL" ACCESS_MODE=manager php83 ../conf-rewrite.php
cd ..
ln -s manager_auth.php auth.php
# rewrite conf in /admin/ faking
if [[ "$APP_URL" != "" ]]
then
ADMIN_APP_URL="${APP_URL}/admin/"
fi
APP_URL="$ADMIN_APP_URL" ACCESS_MODE=manager php83 ../conf-rewrite.php
cd ..
ln -s listing_auth.php auth.php
fi

Expand All @@ -32,6 +32,13 @@ then
ln -s manager_auth.php auth.php
fi

php-fpm83 -D
# run php-fpm as root so we can write to destination without fumbling with perms
if [[ "$ACCESS_MODE" != "listing" ]]
then
sed -i 's/user = nobody/user = root/g' /etc/php83/php-fpm.d/www.conf
sed -i 's/group = nobody/group = root/g' /etc/php83/php-fpm.d/www.conf
FPMOPTS=--allow-to-run-as-root
fi
php-fpm83 -D $FPMOPTS

exec "$@"

0 comments on commit 5cbf3e9

Please sign in to comment.