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.
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.
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.
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.
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.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With