summaryrefslogtreecommitdiff
path: root/Temporary set permissions with which new files are created.md
blob: a8c258effb5849471ebaaa904c1022822fe76fd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
tags:
  - bash
---
[[Bash]] 

Using `umask` one can set the file permissions that are set when creating a new file. 

Maximum permissions allowed for files and directories are differerent: 
- Files max: 0666
- Dirs max: 0777

Thus take care when setting `umask` because the effect is different on files than directories.

To get the correct mask, just subtract the mask from the maximum permissions. For example, mask 0066 would create files 0600 < 6 - 6 = 0.
This same umask would make directories with 0711.