Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the umask of the Apache user

Tags:

linux

apache

I am setting up a LAMP server and would like to set Apache's umask setting to 002 so that all Apache-created files have the group write permission bit set (so members of the same group can overwrite the files).

Does anyone know how to do this? I know that on Ubuntu, you can use the /etc/apache2/envvars file to configure the umask, but the server is running CentOS.

Update This question is related to another I asked a while ago (Linux users and groups for a LAMP server). If prefered, please update this other question with what the best set-up is to use for having a developer user on a server that can edit files created by the apache user.

like image 841
DavidWinterbottom Avatar asked Jan 09 '09 15:01

DavidWinterbottom


People also ask

How do I change the umask value for a specific user?

If you want to specify a different value on a per-user basis, edit the user's shell configuration files such as ~/. bashrc or ~/. zshrc . You can also change the current session umask value by running umask followed by the desired value.

How do I change my umask settings?

To change your umask during your current session only, simply run umask and type your desired value. For example, running umask 077 will give you read and write permissions for new files, and read, write and execute permissions for new folders.

What is umask setting?

Umask Overview umask (user file-creation mode) is a Linux command that lets you set up default permissions for newly created files and folders. 2. A user-defined permissions 'mask'. A user can choose how to restrict permissions by using a permissions mask.

What does umask 022 do?

Brief summary of umask value meanings: umask 022 - Assigns permissions so that only you have read/write access for files, and read/write/search for directories you own. All others have read access only to your files, and read/search access to your directories.


1 Answers

For CentOS and other Red Hat distros, add the umask setting to /etc/sysconfig/httpd and restart apache.

 [root ~]$ echo "umask 002" >> /etc/sysconfig/httpd [root ~]$ service httpd restart 

More info: Apache2 umask | MDLog:/sysadmin

For Debian and Ubuntu systems, you would similarly edit /etc/apache2/envvars.

like image 159
Patrick Fisher Avatar answered Sep 22 '22 00:09

Patrick Fisher