How to set umask for php5-fpm on Debian?
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:
- Manually edit
/etc/systemd/system/multi-user.target.wants/php5-fpm.service
file and addUMask=0002
line inside[Service]
section. - Run command
systemctl daemon-reload
- Run command
systemctl restart php5-fpm.service
Now the service file looks like this:
[Unit]Description = The PHP FastCGI Process ManagerAfter = network.target[Service]Type = notifyPIDFile = /var/run/php5-fpm.pidExecStartPre = /usr/lib/php5/php5-fpm-checkconfExecStart = /usr/sbin/php5-fpm --nodaemonize --fpm-config /etc/php5/fpm/php-fpm.confExecReload = /bin/kill -USR2 $MAINPID; Added to set umask for files created by PHPUMask = 0002[Install]WantedBy = multi-user.target
Note that:
- You can not use
systemctl edit php5-fpm.service
command asedit
option was introduced insystemctl
version 218 but Debian 8 ships with version 215. - Adding
*.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).