From 3703af0d660ec01ce426ed7d8c606c8a1ca8fcb8 Mon Sep 17 00:00:00 2001 From: nmemmert <67961292+nmemmert@users.noreply.github.com> Date: Thu, 6 Nov 2025 08:29:16 -0500 Subject: [PATCH] Improve static file permissions handling in installer - Add fallback for chown failure by using group permissions - Add www-data to user's group and set appropriate group permissions - This handles cases where chown is not permitted (e.g., certain filesystems) --- ubuntu-install.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ubuntu-install.sh b/ubuntu-install.sh index 6c7d239..213f568 100644 --- a/ubuntu-install.sh +++ b/ubuntu-install.sh @@ -85,8 +85,17 @@ fi log_info "Setting permissions for static files..." chmod -R 755 static/ find static/ -type f -exec chmod 644 {} \; -# Ensure nginx can access static files -sudo chown -R www-data:www-data static/ +# Ensure nginx can access static files - try chown, fallback to group permissions +if sudo chown -R www-data:www-data static/ 2>/dev/null; then + log_success "Static files ownership set to www-data" +else + log_warning "Could not change ownership to www-data, using group permissions instead" + # Add www-data to the user's group and set group permissions + sudo usermod -a -G $USER www-data 2>/dev/null || true + sudo chmod -R 750 static/ + find static/ -type f -exec sudo chmod 640 {} \; + log_info "Set group permissions for nginx access" +fi # Create Python virtual environment log_info "Creating Python virtual environment..."