From 8b8768fd776f9d15efd5aeb9d65cd943c0bfc920 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 28 Jun 2024 18:09:35 +0200 Subject: [PATCH] Only set www-data as group for webapps --- helpers/helpers.v2.1.d/utils | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/helpers/helpers.v2.1.d/utils b/helpers/helpers.v2.1.d/utils index 2ee0b5d38..f03e67804 100644 --- a/helpers/helpers.v2.1.d/utils +++ b/helpers/helpers.v2.1.d/utils @@ -258,8 +258,13 @@ _ynh_apply_default_permissions() { then # Files inside should be owned by $app/www-data with rw-r----- (+x for folders or files that already have +x) chmod -R u=rwX,g=r-X,o=--- "$target" + local group="$app" # We set the group to www-data because most apps do serve static assets that need to be readable by nginx ... - chown -R "$app:www-data" "$target" + # The fact that the app is a webapp is infered by the fact that $domain and $path are defined + if [[ -n "${domain:-}" ]] && [[ -n "${path:-}" ]] then + group="www-data" + fi + chown -R "$app:$group" "$target" return fi fi