What umask will set the file permissions on a newly created file to -rw-r–r– (644)?
A.
0002
B.
0022
C.
0224
D.
0246
Explanation/Reference:
The trick is to know that umask on a file excludes execute-priviliges per default, so to remove the write-privilige on a file use 022.
must be 133 or 0133.
to file is 0666. So 0666-0644=0022
A file will never be “automatically executable” when you configure a umask on it.
You could make a test: As root create a directory inside /home, then, create a text file inside /home too. You will see that when using a umask of 0022, they will have different permissions:
root@workstation:/home# mkdir teste
root@workstation:/home# touch testefile
root@workstation:/home# ls -l
total 24
drwx—— 2 root root 16384 Jan 5 08:43 lost+found
drwxr-x— 34 nicolas nicolas 4096 Jan 12 09:56 nicolas
drwxr-xr-x 2 root root 4096 Jan 12 10:33 teste
-rw-r–r– 1 root root 0 Jan 12 10:33 testefile
Answer A is also correct. It’s the default permission for Red-Head. In Red-Head the permission for 644 is 002.