From 7c85753bfa5716271f40b860ddfb9ba2be04bc26 Mon Sep 17 00:00:00 2001 From: osaajani <> Date: Sat, 3 Apr 2021 18:30:05 +0200 Subject: [PATCH] only root try to give another group to file --- controllers/internals/Tool.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/internals/Tool.php b/controllers/internals/Tool.php index e5b71f9..a207185 100644 --- a/controllers/internals/Tool.php +++ b/controllers/internals/Tool.php @@ -323,7 +323,7 @@ namespace controllers\internals; throw new \Exception('Cannot give dir ' . $new_dir . ' to user : ' . fileowner(PWD_DATA_PUBLIC)); } - if (!chgrp($new_dir, filegroup(PWD_DATA_PUBLIC))) + if (posix_getuid() === 0 && !chgrp($new_dir, filegroup(PWD_DATA_PUBLIC))) //If we are root, try to give the file to a proper group { throw new \Exception('Cannot give dir ' . $new_dir . ' to group : ' . filegroup(PWD_DATA_PUBLIC)); }