08-18-2010, 08:20 AM | #1 |
Administrator
Join Date: Jul 2010
Posts: 402
Rep Power: 10 |
Apache Umask and Writeable Files
Had an interesting issue arise this week. A couple servers I administer are loaded with many individual sites. Eventually root will create a file in one of these sites and when the user of that site logs in via FTP, they cannot modify the file (they do not own it). As a part of our weekly maintenance, we would go through each site and recursively CHOWN all the files to the proper ownerships. This though did not take into consideration files created by Apache. For example, a PHP script may create a directory somewhere. Once you change the ownership, even if the the user belongs to the Apache group, the directory becomes unwriteable to Apache.
After some searching I found a way around this. Set the umask variable to 002. It depends on your flavor of Linux but with CentOS and Redhat, you just add this to your /etc/sysconfig/httpd file: Code:
umask 002 This still allows us to change ownerships weekly, but still keeps files created by Apache writeable for Apache. |
Reply With Quote |
01-25-2024, 10:08 AM | #2 |
Junior Member
Join Date: Jan 2024
Posts: 1
Rep Power: 0 |
How did you come across this issue, and have you encountered any other challenges related to file permissions and ownership in your server administration tasks?
|
Reply With Quote |
Reply |
Tags |
apache security
,
php and apache
,
|
Thread Tools | |
|
|