010-100 · Question #4
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. For a file to be readable by all users, the read bit must be set for owner, group, and others. chmod 444 and chmod 644 both satisfy this requirement.
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
(28 responses)- A7% (2)
- B79% (22)
- C4% (1)
- E11% (3)
Why each option
For a file to be readable by all users, the read bit must be set for owner, group, and others. chmod 444 and chmod 644 both satisfy this requirement.
chmod 111 sets --x--x--x, which grants only execute permission to all users and no read permission to anyone.
chmod 444 sets permissions to r--r--r--, granting read-only access to the owner, group, and all other users, making the file universally readable.
chmod 770 sets rwxrwx---, which grants no permissions to others, so users outside the owner and group cannot read the file.
chmod 644 sets permissions to rw-r--r--, giving the owner read and write access while granting read-only access to group and others, so all users can read the file.
chmod 640 sets rw-r-----, which grants no permissions to others, so users outside the owner's group cannot read the file.
Concept tested: Linux chmod octal permissions for universal file readability
Source: https://man7.org/linux/man-pages/man1/chmod.1.html
Topics
Community Discussion
No community discussion yet for this question.