What umask will set the file permissions on a newly created file to -rw-r–r– (644)?

What umask will set the file permissions on a newly created file to -rw-r–r– (644)?

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.



Leave a Reply 4

Your email address will not be published. Required fields are marked *


tsrreven

tsrreven

must be 133 or 0133.

david

david

to file is 0666. So 0666-0644=0022

nwildner

nwildner

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

Fin

Fin

Answer A is also correct. It’s the default permission for Red-Head. In Red-Head the permission for 644 is 002.