Apache2: umask setting for files created by mod_dav

Hello everyone,

I've been searching for the solution to this problem on the web for some time, and finally figured I'd pose the question here in the hopes that someone else has resolved it.

The issue is this: On my Linode, I'm running Ubuntu 10.04 with Apache 2.2.14 and mod_dav. One of the things I use this for is to sync Firefox bookmarks and hit the JSON file with a Perl script that generates a nice clean HTML file, complete with collapsing folders and all. It's very useful when I'm somewhere on a browser that doesn't have my bookmarks.

The problem is that as a DAV folder, the bookmarks are being written with no group access whatsoever. Essentially, the umask is being set to 077. I've found hundreds of links online that suggest adding a line to the end of /etc/inid.d/apache2 like the following:

umask 002

and a great many people appear to be getting satisfaction from that fix, even on Ubuntu 10.04. Not me.

I've also tried adding this line to /etc/apache2/envvars as well as /etc/profile and even /usr/sbin/apache2ctl. All to no avail.

It seems that the umask in the version of Apache I'm running is resetting its umask after the umask command I'm inserting into the various scripts.

Short of poring through the Apache and mod_dav code to generate a custom patch, does anyone have a configuration change of some kind that will work?

I am not willing to use a cron job to run chmod every so often, primarily because this is relatively heavy in resource use - the file in question might only be updated once every week or more, though I want the html generator to be able to do this quickly (within a few hours).

Many thanks in advance,

Lou

3 Replies

Hey,

I'm having absolutely the same issue, tried the same remedies that you described, but nothing worked as well.

Will be grateful to anyone, who could suggest the solution.

What if you setgid on the directory? I had to do that so that files created by my perl scripts would be in the www-data group, or else Apache couldn't read them.

chmod g+s Any files and subdirectories would inherit the group ID of that directory. May be security implications to this, if it even helps at all.

@haus:

What if you setgid on the directory? I had to do that so that files created by my perl scripts would be in the www-data group, or else Apache couldn't read them.

chmod g+s Any files and subdirectories would inherit the group ID of that directory. May be security implications to this, if it even helps at all.

Haus, thanks for your suggestion! I gave it a try, and actually was full of hope it would help, but unfortunately it didn't. The new file came up with -rw–----- as usual.

So far the only remedy I could find is to put chmod command into crontab, which is nothing but a nasty hack :(

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct