010-160 · Question #11
Which permissions are set on a regular file once the permissions have been modified with the command chmod 654 file.txt?
The correct answer is E. -rw-r-xr--. The octal value 654 passed to chmod maps to rw-r-xr-- for owner, group, and others respectively on a regular file.
Question
Options
- Adrw-r-xr--
- Bd-wxr-x--
- C-rw-r-x-r
- D-rw-r-r--x
- E-rw-r-xr--
How the community answered
(58 responses)- A2% (1)
- B16% (9)
- C5% (3)
- D3% (2)
- E74% (43)
Why each option
The octal value 654 passed to chmod maps to rw-r-xr-- for owner, group, and others respectively on a regular file.
The leading 'd' indicates a directory, not a regular file, so this string cannot represent the result of chmod on a regular file.
A leading 'd' again incorrectly designates a directory, and the bits -wxr-x-- do not correspond to the octal values 6, 5, and 4.
Standard Unix permission strings contain exactly 9 permission bits after the file-type character; a trailing standalone 'r' in position 10 is syntactically invalid.
The others field shows '-r--x' which would be octal 5, not octal 4 as required; the correct others bits for digit 4 are r-- (read only, no execute).
The leading '-' denotes a regular file. Octal digit 6 (binary 110) assigns the owner rw-, octal 5 (binary 101) assigns the group r-x, and octal 4 (binary 100) assigns others r--. Combining the file-type character with the three permission triplets produces the string -rw-r-xr--, which matches choice E exactly.
Concept tested: Octal chmod notation and permission bit translation
Source: https://man7.org/linux/man-pages/man1/chmod.1.html
Topics
Community Discussion
No community discussion yet for this question.