Exam LFCS All QuestionsBrowse all questions from this exam
Question 93

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

    Correct Answer: D

    To determine the umask value that ensures new files have the permissions -rw-r-----, we need to understand how umask works. The umask value specifies which permission bits to turn off when creating a new file. The default permissions for files are 666 (rw-rw-rw-). To achieve -rw-r----- (which is 640 in octal), you need to subtract the desired permissions from the default. The calculation would be 666 - 640 = 027. Therefore, setting the umask to 0027 will ensure that new files have the default permissions of -rw-r-----.

Discussion
rona962Option: D

The correct setting for umask to ensure that new files have the default permissions -rw-r----- is option D, 0027. Explanation: The umask command is used to set the default file creation permissions for new files and directories. It works by subtracting the umask value from the maximum permissions allowed. The default permissions for files are 666 in octal (rw-rw-rw-), and the default permissions for directories are 777 in octal (rwxrwxrwx). To achieve -rw-r----- for new files, we need to subtract 027 (binary 000 010 111) from the default file permissions 666 (binary 110 110 110). The result of this subtraction is 640 (binary 110 100 000) in octal notation. Therefore, to ensure that new files have the default permissions -rw-r-----, the umask value should be set to 0027.

sedwipeOption: D

I don't agree, to determine the umask you should do: 0777-0027=0750 which is not reflecting the actual answer.

jjnicks

It is correct for file. Dir is 777- mask, file is 666-mask. A 7 in umask means no permission. Umask 0027 is 750(dir) and 640(file).