CompTIA Linux+ (XK0-004) — Question 49
A Linux user wants to give read-only permissions to a directory and its contents. Which of the following commands will allow the user to accomplish this task?
Answer options
- A. chmod ג€"R 400 /new_directory/
- B. chmod ג€"R 600 /new_directory/
- C. chmod 400 /new_directory/
- D. chmod 600 /new_directory/
Correct answer: A
Explanation
The correct answer is A because the command 'chmod -R 400 /new_directory/' applies read-only permissions recursively to the directory and its contents. Options B and D grant write permissions, which contradicts the requirement for read-only access. Option C only sets permissions for the directory itself, not its contents, therefore it is not suitable for this task.