umask will be used for setting the default file creation permissions.When a file is created, its permissions are set by default, depending on the umask setting configured.
This value is usually set for all users in /etc/profile and can be obtained by typing command umask:
The default umask value is usually 022. It is an octal number which indicates what rights will be removed by default to all newly created files by a user.For example, 022 indicates that write permissions will not be given to group and other.
For example, with umask value of 000, files get mode 666 and directories get mode 777. As a result, with a default umask value of 022, newly created files get a default mode 644 (666 - 022 = 644) and directories get a default mode 755 (777 - 022 = 755).
To change the umask value:
For example, if you want by default all the,
- New directories to get permissions rwxr-x---- (Mode: 750)
- New files to get permissions rw-r----- (Mode 640)
You need to use a umask value which removes all rights to other, and write permissions to the group and the value is 027. The command to use to set this:
# umask 027