101-500 Exam QuestionsBrowse all questions from this exam

101-500 Exam - Question 82


Which of the following settings for umask ensures that new files have the default permissions -rw-r-----?

Show Answer
Correct Answer: E

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.

Discussion

7 comments
Sign in to comment
dlusOption: E
Jul 10, 2020

umask 027: dirs 750, files 640

mentor84
May 13, 2020

Why not 0026? isn't these files with starting permissions of 666?

jobwongdavila
Jun 26, 2020

that's not a valid value for umask since it applies for directories as well

Jcob
Feb 17, 2021

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?

K1lroy
Feb 24, 2021

I believe it is because files are by default rw- without x. So you don't need to take the 1 away

CuriousLinuxCat
Jun 27, 2021

Closest I can get it to is 026.

blk_542Option: E
Nov 19, 2022

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)

NeoSam999Option: E
Jan 16, 2023

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-----

NeoSam999
Jan 16, 2023

Correction: Files with default 027: 666 - 027 = 640

amwangi
Jun 14, 2021

this answer is available coz its 0026