用户WWW的数据“有时'遗忘'的群体(但只是有时) [英] User 'www-data' is sometimes 'forgetting' its groups (but only sometimes)

查看:99
本文介绍了用户WWW的数据“有时'遗忘'的群体(但只是有时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立在/ var /沙箱,通过该网站一些PHP code运行应该被允许改变沙盒区域。我已经设定,让沙箱文件夹有775权限并分配到组沙盒用户,然后添加组沙盒用户到www数据用户配置文件,以便它可以进行编辑当通过Apache运行。

I am trying to set up a sandboxed area in /var/sandbox that some php code run through the website should be allowed to change. I've set it up so that the sandbox folder has 775 permissions and is assigned to the group 'sandbox-users', then added the group 'sandbox-users' to the 'www-data' user profile so that it can be edited when run through Apache.

不过,PHP脚本,我只在运行一些工作的时候,似乎这是因为有时WWW的数据忘记了它是沙盒用户组的一部分。我有以下线在我的PHP code:

However, the php script I'm running only works some of the time, and it seems that this is because sometimes 'www-data' forgets that it is part of the 'sandbox-users' group. I have the following line in my php code:

echo shell_exec('whoami') . " | " . shell_exec('whoami | groups') . "<br>";

该脚本工作的时代,我(适当地)得到的输出:

The times that the script works, I (appropriately) get the output:

www-data | www-data sandbox-users

当它不工作,我只是拿回:

When it doesn't work, I just get back:

www-data | www-data

有似乎没有任何模式时,脚本工作,当它没有 - 它来回切换,如果给定的时间

There doesn't seem to be any pattern to when the script works and when it doesn't - it switches back and forth if given time.

是否有任何理由,WWW的数据将放弃其群体?而且是有什么办法prevent呢?

Is there any reason that www-data would drop its groups? And is there any way to prevent this?

编辑:另一个有趣的皱纹添加到这一点,如果我去到终端,运行组www数据,它告诉我,WWW的数据是沙盒用户组中始终,包括其间的几秒钟两次失败的脚本运行,让我上面列出的第二输出(无沙盒用户组)。

To add another interesting wrinkle to this, if I go to the terminal and run 'groups www-data', it tells me that www-data is in the sandbox-users group always, including in the few seconds between two failed script runs that give me the second output (no sandbox-users group) listed above.

推荐答案

@regilero是现货上 - Web服务器尚未重新启动,一些Apache进程是从WWW的数据组已更改之前的遗产。这样的随机性是基于所述网页是否从一个较新的或旧的进程提供。重新启动这些进程解决了这个问题。永远记住IT的第一条规则:重启,看看能否解决

@regilero was spot on - the web server had not been restarted and some of the apache processes were legacies from before the www-data group was changed. So the randomness was based on whether the webpage was served from a newer or older process. Restarting these processes solved this issue. Always remember the first rule of IT: restart and see if that fixes it!

这篇关于用户WWW的数据“有时'遗忘'的群体(但只是有时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆