010-150 · Question #5
Which TWO commands can be used to make the file /tmp/foo.txt readable for all users?
The correct answer is B. chmod 444 /tmp/foo.txt D. chmod 644 /tmp/foo.txt. Two chmod commands grant read permission to all users: 444 assigns read-only to everyone, and 644 assigns read-write to the owner and read-only to group and others.
Question
Which TWO commands can be used to make the file /tmp/foo.txt readable for all users?
Options
- Achmod 111 /tmp/foo.txt
- Bchmod 444 /tmp/foo.txt
- Cchmod 770 /tmp/foo.txt
- Dchmod 644 /tmp/foo.txt
- Echmod 640 /tmp/foo.txt
How the community answered
(38 responses)- A11% (4)
- B82% (31)
- C5% (2)
- E3% (1)
Why each option
Two chmod commands grant read permission to all users: 444 assigns read-only to everyone, and 644 assigns read-write to the owner and read-only to group and others.
chmod 111 sets only the execute bit for all three categories, granting no read permission to any user.
chmod 444 sets the read bit (4) for owner, group, and others, giving every user read access with no write or execute permissions, satisfying the requirement for all users.
chmod 770 grants read, write, and execute to the owner and group but assigns zero permissions to others, so non-group users cannot read the file.
chmod 644 sets read-write (6) for the owner and read (4) for both group and others, so every user on the system retains at least read access to the file.
chmod 640 grants read-write to the owner and read to the group, but assigns no permissions to others, leaving users outside the group unable to read the file.
Concept tested: Linux octal chmod notation and read permissions
Source: https://man7.org/linux/man-pages/man1/chmod.1.html
Topics
Community Discussion
No community discussion yet for this question.