only root try to give another group to file

This commit is contained in:
osaajani 2021-04-03 18:30:05 +02:00
parent e06079e6af
commit 7c85753bfa
1 changed files with 1 additions and 1 deletions

View File

@ -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));
}