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)
Asked
Active
Viewed 9,069 times
3 Answers
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
-
4You probably [don't need](https://wiki.archlinux.org/index.php/systemd#Editing_provided_unit_files) `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
10
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
NotI.mportant
- 101
- 1
- 5
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
Andrew Schulman
- 8,561
- 21
- 31
- 47
Marcel Kraan
- 17
- 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 '15 at 21:35