From cfb07a6e9333d9090c96fa91c48b9548d590ac8b Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sun, 17 Aug 2025 11:26:47 -0700 Subject: [PATCH] Use the www-data user rather than creating a hugo user. --- Config/HugoExample/Dockerfile | 4 ++-- Config/HugoExample/files/hugo.crontab | 2 +- Config/HugoExample/files/main.sh | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Config/HugoExample/Dockerfile b/Config/HugoExample/Dockerfile index 9190490..778195b 100644 --- a/Config/HugoExample/Dockerfile +++ b/Config/HugoExample/Dockerfile @@ -8,7 +8,7 @@ FROM debian:bookworm-slim RUN apt-get update && apt-get install -y git hugo nginx cron curl bash sudo htop # User and Group -RUN groupadd -r hugo && useradd -r -g hugo hugo +#RUN groupadd -r hugo && useradd -r -g hugo hugo # Hugo Directory Tree RUN mkdir -pv /var/www/hugo/ @@ -22,7 +22,7 @@ COPY files/hugo.cronjob.sh /var/www/hugo/cronjob.sh RUN crontab /etc/cron.d/hugo # Hugo User Permissions -RUN chown -Rv hugo:hugo /var/www/ +RUN chown -Rv www-data:www-data /var/www/ RUN chmod +x /var/www/hugo/cronjob.sh # Copy Start Script diff --git a/Config/HugoExample/files/hugo.crontab b/Config/HugoExample/files/hugo.crontab index 4bfa3ec..cd21442 100644 --- a/Config/HugoExample/files/hugo.crontab +++ b/Config/HugoExample/files/hugo.crontab @@ -1 +1 @@ -* * * * * hugo /var/www/hugo/cronjob.sh +* * * * * www-data /var/www/hugo/cronjob.sh diff --git a/Config/HugoExample/files/main.sh b/Config/HugoExample/files/main.sh index 77049d0..5ee4ac1 100644 --- a/Config/HugoExample/files/main.sh +++ b/Config/HugoExample/files/main.sh @@ -12,7 +12,7 @@ typeset -u DEV echo "DEV=$DEV" echo "*** Creating Git Repo ***" -sudo -u hugo git clone --recurse-submodules $REPO /var/www/hugo/site +sudo -u www-data git clone --recurse-submodules $REPO /var/www/hugo/site status="$?" echo "*** Validating Git Repo ***" @@ -25,7 +25,7 @@ echo "* Site exists!" echo "*** Copying Static Files to NGINX ***" rm -rfv /var/www/html/* -sudo -u hugo /var/www/hugo/cronjob.sh +sudo -u www-data /var/www/hugo/cronjob.sh echo "*** Starting Cron ***" service cron start @@ -58,7 +58,7 @@ if [[ "$DEV" == "Y"* || "$DEV" == "T"* ]]; then echo "* Dev server not detected, starting..." cd /var/www/hugo/site killall hugo 2>/dev/null - sudo -u hugo hugo server -D --noBuildLock --bind 0.0.0.0 -p 1380 & + sudo -u www-data hugo server -D --noBuildLock --bind 0.0.0.0 -p 1380 & fi sleep 30 done &