XK0-004 · Question #247
Users in the sales department are unable to create new files in the shared directory /Sales. A junior Linux administrator determines the permissions on the /Sales directory are set to rwxr-----, and…
The correct answer is B. chmod 770 /Sales. Creating files in a Linux directory requires both write and execute permissions for the group, and chmod 770 grants exactly those permissions to the sales group without over-permitting access to others.
Question
Users in the sales department are unable to create new files in the shared directory /Sales. A junior Linux administrator determines the permissions on the /Sales directory are set to rwxr-----, and sales is the group owner of the directory. Which of the following is the BEST command for the junior administrator to issue to allow the users to create new files?
Options
- Aumask 002
- Bchmod 770 /Sales
- Cchmod g+s /Sales
- Dchmod 777 /Sales
How the community answered
(44 responses)- A2% (1)
- B91% (40)
- C2% (1)
- D5% (2)
Why each option
Creating files in a Linux directory requires both write and execute permissions for the group, and chmod 770 grants exactly those permissions to the sales group without over-permitting access to others.
umask 002 sets the default creation mask applied to new files and directories going forward but has no effect on the existing permissions already set on /Sales.
chmod 770 sets the directory permissions to rwxrwx---, giving the owner and the sales group full read, write, and execute access while blocking all other users. On Linux, creating new files inside a directory requires write permission to add the new directory entry and execute permission to traverse and access the directory - both of which chmod 770 provides to the group.
chmod g+s sets the setgid bit so new files inherit the directory's group ownership, but it does not add write or execute permission to the group and therefore does not enable users to create new files.
chmod 777 grants full read, write, and execute permissions to all users including those outside the sales group, which violates the principle of least privilege and unnecessarily exposes the shared directory.
Concept tested: Linux directory write and execute permissions for group file creation
Source: https://www.gnu.org/software/coreutils/manual/html_node/chmod-invocation.html
Topics
Community Discussion
No community discussion yet for this question.