Which command is used to recursively grant the group read and write permissions and also execute permissions on directories when using the -R option?

Prepare for the Red Hat Certified Systems Admin Exam EX200. Enhance your skills with interactive quizzes, flashcards, and detailed explanations. Ace your certification exam today!

Multiple Choice

Which command is used to recursively grant the group read and write permissions and also execute permissions on directories when using the -R option?

Explanation:
Granting group read and write across everything while making directories enterable relies on using the capital X in symbolic mode. The command that does this is chmod -R g+rwX /DIR. Here's why it works: -R applies the permission changes recursively, so every file and directory inside /DIR is affected. The g+rw part gives the group read and write permissions to all items. The capital X is a conditional execute: it adds the execute bit only when the target is a directory (so users can enter it) or when the item already had execute permission. This ensures directories get execute permission for the group, enabling traversal, while regular files don’t receive unnecessary execute bits unless they already had them. Other options either omit write permissions, don’t provide execute on directories, or apply execute broadly to files, which isn’t desirable when you only want directory traversal.

Granting group read and write across everything while making directories enterable relies on using the capital X in symbolic mode. The command that does this is chmod -R g+rwX /DIR.

Here's why it works: -R applies the permission changes recursively, so every file and directory inside /DIR is affected. The g+rw part gives the group read and write permissions to all items. The capital X is a conditional execute: it adds the execute bit only when the target is a directory (so users can enter it) or when the item already had execute permission. This ensures directories get execute permission for the group, enabling traversal, while regular files don’t receive unnecessary execute bits unless they already had them.

Other options either omit write permissions, don’t provide execute on directories, or apply execute broadly to files, which isn’t desirable when you only want directory traversal.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy