Home / VPS & Dedicated / How to setup umask on a Linux server

How to setup umask on a Linux server

terminal iconIn Linux umask, or user file-creation mode mask, determines the permissions of new files. In other words, whenever you make a new file or upload/transfer a file from your local machine or another server, umask sets the initial permissions of that file.

In most Linux distributions, umask for all users is set in /etc/bashrc or /etc/profile. It uses a four digit code to determine the permissions. The default umask is 0002, which sets default directory permissions to 775 and default file permissions to 664. Use this simple calculation to determine the umask code for a permission:

Subtract the permission you want from the default file permission:

777 - 755 = 022

Similarly, for directories:

666 - 644 = 022

For a complete explanation of umask settings, type man umask from the command line.

Image Source: Wikimedia Commons

Check Also

Server collocation

Server colocation

Server colocation is an incredible good choice for people as well as small businesses who …