Which of the following settings for umask ensures that new files have the default permissions -rw-r-----?
Which of the following settings for umask ensures that new files have the default permissions -rw-r-----?
The umask value determines the default permissions assigned to new files and directories. By default, the file permission mode is 666 (read and write for everyone) and for directories, it is 777 (read, write, and execute for everyone). The umask value subtracts permissions from these defaults. A umask value of 0027 will remove write permissions for the group and all permissions for others. This results in new files having permissions -rw-r----- (640). Therefore, the correct umask setting to give new files the default permissions -rw-r----- is 0027.
umask 027: dirs 750, files 640
Why not 0026? isn't these files with starting permissions of 666?
that's not a valid value for umask since it applies for directories as well
Hang on but why it isnt 0137? I though since chmod RW-R---- is 640 I would guess it would be when eliminating the numbers 0/7/7/7 -0/6/4/0 0/1/3/7 can someone explain please?
I believe it is because files are by default rw- without x. So you don't need to take the 1 away
Closest I can get it to is 026.
0027: Initial 0: ignored second 0: rw for files (rwx for directories) 2: r for files (rx for directories) 7: nothing (for both files and directories)
Default permissions: 777 = default permissions for directories 666 = default for files Default umask: 0002 To change umask: ~$ umask 027 ~$ umask 0027 To check new files have the default permissions -rw-r----- ~$ touch umask-test ~$ ls -l umask-test -rw-r----- 1 neo neo 0 Jan 1 18:01 umask-test Easy explanation: r = 4 w = 2 x = 1 Files with default 002: 666 - 022 = 644 Files with default 027: 666 - 027 = 644 0 = user / 2 = Group / 7 = Others Files: 666 - 027 = 640 = -rw-r-----
Correction: Files with default 027: 666 - 027 = 640
this answer is available coz its 0026