我对 Linux 权限、用户/组的理解有些问题。
我正在使用 Apache 运行 PHP Web 应用程序。运行 Apache 的用户是 Linux 用户“apache”。
包含 PHP Web 应用程序的文件夹包含分配给用户“andre”的文件和文件夹。我已将用户“apache”分配给组“andre”。
[2016-12-14 15:51:01] Espo.WARNING: E_WARNING: touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied {"code":2,"message":"touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied","file":"/var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php","line":518,"context":{"filePath":"data/cache/application/cronLastRunTime.php","defaultPermissions":{"dir":"0775","file":"0664","user":48,"group":48},"pathParts":{"dirname":"data/cache/application","basename":"cronLastRunTime.php","extension":"php","filename":"cronLastRunTime"}}} []
[2016-12-14 15:51:01] Espo.ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Permission denied for data/cache/application/cronLastRunTime.php" at /var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php line 212 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Permission denied for data/cache/application/cronLastRunTime.php at /var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php:212)"} []
[2016-12-14 15:52:01] Espo.WARNING: E_WARNING: touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied {"code":2,"message":"touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied","file":"/var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php","line":518,"context":{"filePath":"data/cache/application/cronLastRunTime.php","defaultPermissions":{"dir":"0775","file":"0664","user":48,"group":48},"pathParts":{"dirname":"data/cache/application","basename":"cronLastRunTime.php","extension":"php","filename":"cronLastRunTime"}}} []
[2016-12-14 15:52:01] Espo.ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Permission denied for data/cache/application/cronLastRunTime.php" at /var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php line 212 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Permission denied for data/cache/application/cronLastRunTime.php at /var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php:212)"} []
[2016-12-14 15:53:01] Espo.WARNING: E_WARNING: touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied {"code":2,"message":"touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied","file":"/var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php","line":518,"context":{"filePath":"data/cache/application/cronLastRunTime.php","defaultPermissions":{"dir":"0775","file":"0664","user":48,"group":48},"pathParts":{"dirname":"data/cache/application","basename":"cronLastRunTime.php","extension":"php","filename":"cronLastRunTime"}}} []
[2016-12-14 15:53:01] Espo.ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Permission denied for data/cache/application/cronLastRunTime.php" at /var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php line 212 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Permission denied for data/cache/application/cronLastRunTime.php at /var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php:212)"} []
[2016-12-14 15:54:01] Espo.WARNING: E_WARNING: touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied {"code":2,"message":"touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied","file":"/var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php","line":518,"context":{"filePath":"data/cache/application/cronLastRunTime.php","defaultPermissions":{"dir":"0775","file":"0664","user":48,"group":48},"pathParts":{"dirname":"data/cache/application","basename":"cronLastRunTime.php","extension":"php","filename":"cronLastRunTime"}}} []
[2016-12-14 15:54:01] Espo.ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Permission denied for data/cache/application/cronLastRunTime.php" at /var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php line 212 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Permission denied for data/cache/application/cronLastRunTime.php at /var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php:212)"} []
[2016-12-14 15:55:02] Espo.WARNING: E_WARNING: touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied {"code":2,"message":"touch(): Unable to create file data/cache/application/cronLastRunTime.php because Permission denied","file":"/var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php","line":518,"context":{"filePath":"data/cache/application/cronLastRunTime.php","defaultPermissions":{"dir":"0775","file":"0664","user":48,"group":48},"pathParts":{"dirname":"data/cache/application","basename":"cronLastRunTime.php","extension":"php","filename":"cronLastRunTime"}}} []
[2016-12-14 15:55:02] Espo.ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Permission denied for data/cache/application/cronLastRunTime.php" at /var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php line 212 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Permission denied for data/cache/application/cronLastRunTime.php at /var/www/somewebsitefolder/public/application/Espo/Core/Utils/File/Manager.php:212)"} []
这是我的 /etc/group
root:x:0:apache
apache:x:48:
andre:x:1000:apache
我是否应该将用户“andre”添加到组“apache”以摆脱这个错误?
此致敬礼,安德烈·洛佩斯。
答案1
为什么要成为apache
该团体的成员root
?这非常不安全。
一般来说,您不应该仅仅通过将项目添加到组来解决权限问题。相反,首先要从根本上了解权限系统的工作原理,然后考虑您想要做什么以及为什么会失败。如果用户andre
是 Apache 组的成员,您会得到什么?该进程以 的身份运行apache:apache
,因此它需要对用户或组 apache 在其想要写入的任何目录中具有写入权限,而您无法通过将用户添加到组来实现这一点apache
。