更新时间:2023-11-15 22:57:40
我能够通过编辑 unit.service
文件为 php5-fpm
服务设置 umask正如建议的此处和此处.Debian 8 的完整且有效的解决方案是这样的:
I was able to set the umask for php5-fpm
service by editing it's unit.service
file as suggested here and here. The complete and working solution for Debian 8 is this:
/etc/systemd/system/multi-user.target.wants/php5-fpm.service
文件并在 中添加 UMask=0002
行[服务]
部分.systemctl daemon-reload
systemctl restart php5-fpm.service
/etc/systemd/system/multi-user.target.wants/php5-fpm.service
file and add UMask=0002
line inside [Service]
section.systemctl daemon-reload
systemctl restart php5-fpm.service
现在服务文件如下所示:
Now the service file looks like this:
[Unit]
Description = The PHP FastCGI Process Manager
After = network.target
[Service]
Type = notify
PIDFile = /var/run/php5-fpm.pid
ExecStartPre = /usr/lib/php5/php5-fpm-checkconf
ExecStart = /usr/sbin/php5-fpm --nodaemonize --fpm-config /etc/php5/fpm/php-fpm.conf
ExecReload = /bin/kill -USR2 $MAINPID
; Added to set umask for files created by PHP
UMask = 0002
[Install]
WantedBy = multi-user.target
注意:
systemctl edit php5-fpm.service
命令,因为 edit
选项是在 systemctl
版本 218 中引入的,但 Debian 8 附带版本 215.*.conf
文件不适用于我,但也许我搞砸了一些东西(欢迎对此发表评论,因为我不喜欢编辑单元文件).systemctl edit php5-fpm.service
command as edit
option was introduced in systemctl
version 218 but Debian 8 ships with version 215.*.conf
file as suggested in comments for this answer did not work for me, but maybe I messed up something (comments are welcome for this as editing unit file is not something that I feel comfortable with).