Sunday, October 25, 2015

linux - How to make apache create files with certain permissions?



I have been told to chgrp and chmod (770 and g+s) the directory I need to be shared between the user 'apache' and the user that owns the website files.



When the owner creates new files in there, they have by default this permissions: 664, which isn't perfect, but it's ok.



The problem is that when apache (with a php script) creates new files in there, they have this permissions: 644.



Then the files created by apache are not writtable by the group. How do I fix that? I want it to be 664 by default, or 770.


Answer




You cannot have both 0664 and 0770, but if you set the umask to 0002 before running httpd then you can have 0664 and 0775. Note that this may require modification of the initscript used to start it.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...