CompTIA Linux+ (XK0-006) — Question 9
Which of the following commands sets all the directories' permissions recursively in the user's home directory and as accessible only to the user?
Answer options
- A. find / -type f -exec: chmod 777 {} \;
- B. find ~ -type d -exec chmod 700 {} \;
- C. find /home -type d -exec chmod 750 {} \;
- D. find $HOME -type d -exec chmod 755 {} \;
Correct answer: B
Explanation
The correct answer is B, as it uses 'find ~ -type d -exec chmod 700 {} \;' to set the permissions of all directories in the user's home directory to 700, allowing only the user access. Option A targets files instead of directories, option C sets permissions to 750 which allows group access, and option D sets permissions to 755, which also allows group access.