In Unix, files can be protected by assigning each one a 9-bit mode called…
2016
In Unix, files can be protected by assigning each one a 9-bit mode called rights bits. Now, consider the following two statements:
I. A mode of 641 (octal) means that the owner can read and write the file, other members of the owner’s group can read it, and users can execute only.
II. A mode of 100 (octal) allows the owner to execute the file, but prohibits all other access.
Which of the following options is correct with reference to above statements ?
- A.
Only I is correct.
- B.
Only II is correct.
- C.
Both I and II are correct.
- D.
Both I and II are incorrect.
Attempted by 29 students.
Show answer & explanation
Correct answer: C
Key idea: each octal digit represents owner, group, and others in that order; digits are sums of 4 (read), 2 (write), and 1 (execute).
For 641: owner = 6 = 4+2 = read and write; group = 4 = read only; others = 1 = execute only.
For 100: owner = 1 = execute only; group = 0 = no permissions; others = 0 = no permissions.
Conclusion: Both statements are correct because the permission breakdowns above match the descriptions in the statements.