How to Set Umask in Apache

As Linux Administrator many time you need to set default permission of files created on a Linux system. You can easily set if you are using bash just define somewhere in the bash script startup file /etc/profile and set the below value.

umask 002

Using above value will allow by default group write permissions on the newly created files.

Set Umask in Apache

You can easily find out the default umask value using below command on Linux system.

# umask

In opposition to what you may think, this isn’t sufficient to have this working for all applications and daemons on the system. This works fine for any files created from a shell session, but the files created by other processes, like the web server for example, will still use the default, unless otherwise configured. In order to have apache use a different umask we can define this inside /etc/apache2/envvars (debian, and ubuntu systems) or /etc/sysconfig/httpd (rhel,centos systems) like below:

umask 002

Next restart the apache service to apply the changes.

# service httpd restart
# service apache2 restart
Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.


    • Sorry David,
      For inconvenience, Actually at that time site was on maintenance that’s why it happned, now it is fixed. Thanks for visiting.

Leave a Comment