我正在设置基本Web服务器的权限,但在使用systemd启动服务器时遇到一些困难。
在我的工作描述中,我将用户和组设置为“foo”,如下所示:
[Service] WorkingDirectiory=/home/otheruser/Website ExecStart=/home/otheruser/Website/bin/site -Dhttp.port=7000 User=foo Group=foo
我recursion地将Website目录的组更改为foo ,并确保为site二进制文件赋予组执行权限。 当我还有问题的时候,我把整个目录foo 。 这是ls -la在bin目录中显示的内容:
drwxr-xr-x 2 foo foo 4096 Sep 5 16:13 . drwxr-xr-x 7 foo foo 4096 Sep 5 18:07 .. -rwxr-xr-x 1 foo foo 8502 Sep 5 16:13 site
无论如何,我仍然遇到这个错误,当试图启动我的系统作业:
foo.service: Failed at step EXEC spawning /home/otheruser/Website/bin/site: Permission denied
任何想法可能导致这个?
经过多次修改之后,我发现树中更高的一些目录(即/home/otheruser )不允许foo执行。 虽然Website目录具有正确的权限,上述目录没有,这是导致失败。