7

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)

3 Answers 3

12

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

Create the file

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

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

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

[Service]
UMask=0002

Then run

 systemctl daemon-reload
 systemctl restart php5-fpm
1
  • 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, 2014 at 10:08
11

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

1
  • this is the simplest and future proof way, works debian 11 Dec 20, 2022 at 23:43
0

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:

[Service]
UMask=0002

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
1
  • 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, 2015 at 21:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .