简体   繁体   English

在systemd中设置php-fpm umask

[英]set php-fpm umask in systemd

I have looked at several other answers and none of them are working. 我已经看了几个其他的答案,但没有一个是有效的。 for example: How to set umask for php5-fpm on Debian? 例如: 如何在Debian上为php5-fpm设置umask?

here's the setup. 这是设置。

I have a cakePHP 2 app running with apache as a reverse proxy for php-fpm on RHEL 7. 我有一个运行apache的cakePHP 2应用程序作为RHEL 7上php-fpm的反向代理。

I've created a site specific user, which we'll call siteuser. 我创建了一个特定于站点的用户,我们称之为siteuser。

The virtual host for this site will do a 'SuexecUserGroup for the siteuser user/group. 此站点的虚拟主机将为siteuser用户/组执行“SuexecUserGroup”。

I've added the php-fpm user to the siteuser group. 我已经将php-fpm用户添加到了siteuser组。

There are specific directories in cakePHP 2 which must be writable. cakePHP 2中有特定目录,必须是可写的。 I've made these directories group writable and set the S bit so new files are created with the group intact. 我已将这些目录组写为可写并设置S位,以便在组完整时创建新文件。

In addition, I set the systemd UMask for php-fpm as follows: 另外,我为php-fpm设置了systemd UMask,如下所示:

/etc/systemd/system/php-fpm.service.d/override.conf /etc/systemd/system/php-fpm.service.d/override.conf

[Service]
UMask=113

After saving this file I do a systemctl daemon-reload && systemctl restart php-fpm. 保存这个文件后,我做了一个systemctl daemon-reload && systemctl restart php-fpm。

however, the files are getting written as 777 rather than the 664 I would expect. 然而,这些文件被写成777而不是我期望的664。

What am I missing? 我错过了什么?

Please add a 0 to your umask for the special permissions bit (ie sticky, setuid, setgid, etc.) 请在umask中为特殊权限位添加0 (即sticky,setuid,setgid等)

[Service]
UMask=0113

Update : 更新

It seems like your changes are not being recognized at all ... I just noticed you are setting this in your override.conf file. 好像你的变化是不被认可在所有 ...我只注意到你在你的设置此override.conf文件。 In this case you need to make sure that override.conf is being included from the main config (IIRC: php5-fpm.service.conf in the same folder). 在这种情况下,您需要确保从主配置(IIRC: php5-fpm.service.conf在同一文件夹中)中包含了override.conf

Also, have a look at this serverfault question that may contain further information for you. 另外,请查看此服务器故障问题 ,其中可能包含更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM