2

I have not been able to set a umask for www-data (apache's user).

I tried to put umask 002, like in many other examples I found, in /etc/init.d/apache2 script, or in /etc/apache2/envvars.... Then I restart my apache server.

As an example, after restarting, if I do:

sudo su - www-data
touch file

The file gets always the default rw-r--r-- permissions (umask 022), while I want rw-rw-r-- (umask 002).

Changing this has been up to now an impossible task in Ubuntu Hardy (8.04).

Can anybody help me please ?

Thanks

1
  • Please review your old questions with answers, accept any valid answers. If there are no valid answers, then add comments or update your questions so that someone can provide valid answers.
    – Zoredache
    Mar 29, 2012 at 20:13

1 Answer 1

3

The umask is specific to a process, not to a user. For example, setting the umask in /etc/init.d/apache will likely make files created by apache umask 002 (assuming the process doesn't enforce specific permissions, or change the umask after you configure it in the init.d script).

However, when you sudo su - www-data, you're not setting a umask in any of the files you've sourced into your shell. You're getting the default umask at this point.

3
  • indeed, I did a little php program to write a new file and it set correctly the group permissions...
    – arod
    Mar 29, 2012 at 21:02
  • "The umask is specific to a process, not to a user" : so why then is it possible to adapt the umask to a specific user in /etc/.profile ?
    – hornetbzz
    May 10, 2012 at 17:11
  • Sure, you can adjust the configuration of /etc/profile to set the umask for a particular user, but it only takes place for the processes created after that change is made. Other processes that are already running have their own umask - regardless of the changes you make elsewhere or running the 'umask' command after starting a shell, etc.
    – Kyle Smith
    May 10, 2012 at 19:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .