如何在Fedora中为php-fpm设置umask

在Fedora 19中,我找不到在哪里设置umask(为php脚本创build的文件设置适当的权限)(具体来说,我希望新文件具有权限664)

以下是我如何最终做到这一点,以防万一,

创build文件

/etc/systemd/system/php5-fpm.service.d/php5-fpm.service.conf 

(它必须以.conf结尾)与内容:

 .include /lib/systemd/system/php5-fpm.service [Service] UMask=0002 

然后运行

  systemctl daemon-reload systemctl restart php5-fpm 

只需运行: systemctl edit unit.service 。 这将为服务创buildoverride.conf。 里面加上: [Service] UMask=0002

并重新启用服务: systemctl reenable unit.service在你的情况unit.service是httpd.service

如果你在CentOs7上有一个systemd服务,你需要停止服务并重新启用它来修复它

 systemctl stop httpd vi /usr/lib/systemd/system/httpd.service 

添加这个:

 [Service] UMask=0002 

用esc ZZ保存文件。 再次启用并启动apache:

 systemctl enable httpd systemctl start httpd 

那么有趣的是,我有774而不是770毫米

 -rw-rw-r-- 1 apache apache 405163 Apr 26 11:04 0FreeRADIUS.pdf -rw-rw-r-- 1 apache apache 42496 Apr 26 11:05 admiraliteitsraad.doc