I cannot find where to set umask (to set proper permissions to files created by php scripts) in Fedora 19. (specifically, I want new files to have the permissions 664)


Here's how I finally did it, in case this helps someone:

Create the file


(it must end in .conf) with the content:

.include /lib/systemd/system/php5-fpm.service


Then run

 systemctl daemon-reload
 systemctl restart php5-fpm
| improve this answer | |
  • 4
    You probably don't need include: To edit a unit file provided by a package, you can create a directory called /etc/systemd/system/unit.d/ for example /etc/systemd/system/httpd.service.d/ and place *.conf files in there to override or add new options. systemd will parse these *.conf files and apply them on top of the original unit. And the name of the file may be different. It works for me on Arch Linux. – x-yuri Sep 12 '14 at 10:08

Just run: systemctl edit unit.service. This will create override.conf for service. Inside add: [Service] UMask=0002

And reenable service: systemctl reenable unit.service In your case unit.service is httpd.service

| improve this answer | |

if you have a systemd service on CentOs7 you need to stop the service and enable it again to have it fixed

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

Add this:


Save the file with esc ZZ. Enable and start apache again:

systemctl enable httpd
systemctl start httpd

Then the funny part is that i have chmod 774 and not 770 mmm

-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
| improve this answer | |
  • Never edit the unit files in /usr/lib. Package updates can blow them away. Instead, edit them in /etc/systemd/system instead. – Boscoe Jul 24 '15 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.