1

I'm trying to make the files that created by webserver (Apache, lighttpd, ...) can be writable by the ftp users. Adding apache to nobody group and the vise versa. umask 002 for ftp works fine. But the webserver seems to ignore my umask setting in /etc/sysconfig/:

grep umask /etc/sysconfig/httpd 
umask 002

or /etc/init.d/:

start() {
    echo -n $"Starting $prog: "
    umask 002
    daemon $lighttpd -f $LIGHTTPD_CONF_PATH
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
    return $RETVAL
}

That files are still created with 755 permission:

-rwxr-xr-x 1 apache nobody 28243 Jul 28 09:49 ssvzone_997.js
-rwxr-xr-x 1 apache nobody 26224 Jul 28 09:49 ssvzone_998.js
-rwxr-xr-x 1 apache nobody 19686 Jul 28 09:49 ssvzone_999.js

-rwxr-xr-x 1 lighttpd nobody 23949 Jul 29 15:50 ssvzone_999_1.js
-rwxr-xr-x 1 lighttpd nobody 20668 Jul 29 15:50 ssvzone_999_2.js
-rwxr-xr-x 1 lighttpd nobody 22294 Jul 29 15:50 ssvzone_999_3.js

So, what is the root cause?

PS: I saw the some similar questions but none of them can help.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
quanta
  • 51,413
  • 19
  • 159
  • 217

2 Answers2

2

Umask doesn't set bits. It could be that the application that creates the files doesn't ask for the group w bit to be set or that it explicitly chmods the file itself to be 'safe'.

What does a simple php script report for the umask ?

<?php 
    system ("umask");
?>

On a CentOS system I have to hand it reports the default 0022 or whatever I set it to in /etc/sysconfig/httpd

user9517
  • 115,471
  • 20
  • 215
  • 297
0

Don't know why file_put_contents() function creates files with 755 permission but @chmod 664 do a trick.

quanta
  • 51,413
  • 19
  • 159
  • 217
  • Looks like I was correct then. Your app isn't asking for the `w` bit to be set so it's nothing to do with umask :) – user9517 Aug 02 '11 at 06:22