> ## Documentation Index
> Fetch the complete documentation index at: https://linux-plus.ipoint-labs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Domain 3 Review Quiz

> 13 practice questions for Domain 3. Configuring Permissions.

13 practice questions covering **Configuring Permissions**. Read the question, take answers from the room, then reveal.

<div className="quiz" data-total="13">
  <div className="quiz__q" data-n="1" data-answer="C">
    <p className="quiz__stem">
      { "A systems administrator wants to prevent the current contents of a file from being overwritten and wants to allow new additions at the end of the file. Which of the following commands should the administrator use?" }
    </p>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A"><span className="quiz__letter">A</span><span className="quiz__text">{ "setenforce file" }</span></li>
      <li className="quiz__choice" data-letter="B"><span className="quiz__letter">B</span><span className="quiz__text">{ "setfacl -m m::t file" }</span></li>
      <li className="quiz__choice" data-letter="C" data-correct="1"><span className="quiz__letter">C</span><span className="quiz__text">{ "chattr +a file" }</span></li>
      <li className="quiz__choice" data-letter="D"><span className="quiz__letter">D</span><span className="quiz__text">{ "chmod +t file" }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: C</p>

      <p className="quiz__why">
        { "The chattr +a command sets the append-only attribute on a file. This prevents overwriting or deletion of existing contents, while still allowing new data to be appended to the end of the file." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="2" data-answer="B">
    <p className="quiz__stem">
      { "A systems administrator attempts to edit a file as root, but receives the following error: Which of the following commands allows the administrator to edit the file?" }
    </p>

    <pre className="quiz__exhibit">
      <code>
        { "# vi /etc/resolv.conf\n\"/etc/resolv.conf\" E212: Can't open file for writing\n# lsattr /etc/resolv.conf\n----i----------- /etc/resolv.conf" }
      </code>
    </pre>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A"><span className="quiz__letter">A</span><span className="quiz__text">{ "chown root /etc/resolv.conf" }</span></li>
      <li className="quiz__choice" data-letter="B" data-correct="1"><span className="quiz__letter">B</span><span className="quiz__text">{ "chattr -i /etc/resolv.conf" }</span></li>
      <li className="quiz__choice" data-letter="C"><span className="quiz__letter">C</span><span className="quiz__text">{ "chmod 750 /etc/resolv.conf" }</span></li>
      <li className="quiz__choice" data-letter="D"><span className="quiz__letter">D</span><span className="quiz__text">{ "chgrp root /etc/resolv.conf" }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: B</p>

      <p className="quiz__why">
        { "The lsattr output shows the immutable (i) attribute set on /etc/resolv.conf. This prevents any modifications, even by root. Running chattr -i removes the immutable flag, allowing the administrator to edit the file." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="3" data-answer="A">
    <p className="quiz__stem">
      { "A user on a Linux VM is running /work/test.sh Bash script and receives the following error: bash: /work/test.sh: Permission denied After further investigation, the user receives the following outputs: Which of the following commands should a systems administrator run to fix the issue?" }
    </p>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A" data-correct="1"><span className="quiz__letter">A</span><span className="quiz__text">{ "mount -o remount,exec /work" }</span></li>
      <li className="quiz__choice" data-letter="B"><span className="quiz__letter">B</span><span className="quiz__text">{ "mount -o remount,suid /work" }</span></li>
      <li className="quiz__choice" data-letter="C"><span className="quiz__letter">C</span><span className="quiz__text">{ "chmod g+x /work/test.sh" }</span></li>
      <li className="quiz__choice" data-letter="D"><span className="quiz__letter">D</span><span className="quiz__text">{ "chmod o+x /work/test.sh" }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: A</p>

      <p className="quiz__why">
        { "The script /work/test.sh already has execute permissions (-rwxr--r--), but the filesystem is mounted with the noexec option, which prevents execution of binaries and scripts. Remounting the filesystem with the exec option allows execution of the script." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="4" data-answer="B">
    <p className="quiz__stem">
      { "Which of the following commands sets all the directories' permissions recursively in the user's home directory and makes them accessible only to the user?" }
    </p>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A"><span className="quiz__letter">A</span><span className="quiz__text">{ "find / -type f -exec: chmod 777 {} \\;" }</span></li>
      <li className="quiz__choice" data-letter="B" data-correct="1"><span className="quiz__letter">B</span><span className="quiz__text">{ "find ~ -type d -exec chmod 700 {} \\;" }</span></li>
      <li className="quiz__choice" data-letter="C"><span className="quiz__letter">C</span><span className="quiz__text">{ "find /home -type d -exec chmod 750 {} \\;" }</span></li>
      <li className="quiz__choice" data-letter="D"><span className="quiz__letter">D</span><span className="quiz__text">{ "find $HOME -type d -exec chmod 755 {} \\;" }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: B</p>

      <p className="quiz__why">
        { "This command searches for all directories within the user’s home directory and sets their permissions to allow access only by the owning user, ensuring privacy and proper access control." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="5" data-answer="D">
    <p className="quiz__stem">
      { "A systems administrator receives reports from users who are having issues while trying to modify newly created files in a shared directory. The administrator sees the following outputs: Which of the following provides the best resolution to this issue?" }
    </p>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A"><span className="quiz__letter">A</span><span className="quiz__text">{ "Adding a setuid bit to the user in the shared folder" }</span></li>
      <li className="quiz__choice" data-letter="B"><span className="quiz__letter">B</span><span className="quiz__text">{ "Manually changing the group of the newly created files" }</span></li>
      <li className="quiz__choice" data-letter="C"><span className="quiz__letter">C</span><span className="quiz__text">{ "Changing all directory contents to be writable and readable for everyone" }</span></li>
      <li className="quiz__choice" data-letter="D" data-correct="1"><span className="quiz__letter">D</span><span className="quiz__text">{ "Adding a setgid bit to the group in the shared folder" }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: D</p>

      <p className="quiz__why">
        { "Setting the setgid bit on the shared directory ensures that all newly created files and subdirectories inherit the directory’s group ownership, allowing all group members to modify files consistently without manual intervention." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="6" data-answer="D">
    <p className="quiz__stem">
      { "A Linux administrator has been informed that user alpha is able to successfully access the /project2/data/ directory, but user beta is not. The administrator observes the following during troubleshooting: The directory permissions are as follows: Which of the following would most likely cause the access discrepancy?" }
    </p>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A"><span className="quiz__letter">A</span><span className="quiz__text">{ "User beta is not a member of the project2 group or subgroups." }</span></li>
      <li className="quiz__choice" data-letter="B"><span className="quiz__letter">B</span><span className="quiz__text">{ "There is an SELinux context preventing user beta from accessing the directory." }</span></li>
      <li className="quiz__choice" data-letter="C"><span className="quiz__letter">C</span><span className="quiz__text">{ "User alpha is a member of a group nested within the project2 group." }</span></li>
      <li className="quiz__choice" data-letter="D" data-correct="1"><span className="quiz__letter">D</span><span className="quiz__text">{ "There is an ACL configured for user alpha on the /project2/data directory." }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: D</p>

      <p className="quiz__why">
        { "The directory has an ACL entry explicitly granting user alpha read and execute permissions. This user-specific ACL allows alpha to access the directory regardless of standard owner, group, or other permissions, while user beta has no such ACL entry and therefore cannot access it under the same conditions." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="7" data-answer="B">
    <p className="quiz__stem">
      { "A systems administrator is creating a new shared directory. Which of the following commands ensures all users from the same group will be able to work with the newly created files?" }
    </p>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A"><span className="quiz__letter">A</span><span className="quiz__text">{ "chmod g+r /shared" }</span></li>
      <li className="quiz__choice" data-letter="B" data-correct="1"><span className="quiz__letter">B</span><span className="quiz__text">{ "chmod g+s /shared" }</span></li>
      <li className="quiz__choice" data-letter="C"><span className="quiz__letter">C</span><span className="quiz__text">{ "chmod g+w /shared" }</span></li>
      <li className="quiz__choice" data-letter="D"><span className="quiz__letter">D</span><span className="quiz__text">{ "chmod g+x /shared" }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: B</p>

      <p className="quiz__why">
        { "Setting the setgid bit on a shared directory causes newly created files and subdirectories to inherit the directory’s group ownership, allowing members of the same group to collaborate consistently on new files." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="8" data-answer="A">
    <p className="quiz__stem">
      { "User1 reports \"access denied\" errors while trying to execute app. Given the following outputs: Which of the following options will remediate this issue?" }
    </p>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A" data-correct="1"><span className="quiz__letter">A</span><span className="quiz__text">{ "Providing execute permissions to user1 in the ACL" }</span></li>
      <li className="quiz__choice" data-letter="B"><span className="quiz__letter">B</span><span className="quiz__text">{ "Modifying the permissions for others to grant read, write, and execute" }</span></li>
      <li className="quiz__choice" data-letter="C"><span className="quiz__letter">C</span><span className="quiz__text">{ "Adding user1 to the wheel group" }</span></li>
      <li className="quiz__choice" data-letter="D"><span className="quiz__letter">D</span><span className="quiz__text">{ "Moving app to a different folder" }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: A</p>

      <p className="quiz__why">
        { "According to the output of getfacl app, user1 has only \"rw\" (read and write) permissions, but lacks \"x\" (execute). Without execute permission, user1 cannot run the file. To allow user1 to execute app, you must update the ACL to add execute permission (e.g., setfacl -m u:user1:rwx app). Modifying \"others\" permissions (option B) is not secure or necessary, adding user1 to the wheel group (option C) is unrelated, and moving the file (option D) does not resolve permission issues." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="9" data-answer="B">
    <p className="quiz__stem">
      { "A Linux administrator tries to install Ansible in a Linux environment. One of the steps is to change the owner and the group of the directory /opt/Ansible and its contents. Which of the following commands will accomplish this task?" }
    </p>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A"><span className="quiz__letter">A</span><span className="quiz__text">{ "groupmod -g Ansible -n /opt/Ansible" }</span></li>
      <li className="quiz__choice" data-letter="B" data-correct="1"><span className="quiz__letter">B</span><span className="quiz__text">{ "chown -R Ansible:Ansible /opt/Ansible" }</span></li>
      <li className="quiz__choice" data-letter="C"><span className="quiz__letter">C</span><span className="quiz__text">{ "usermod -aG Ansible /opt/Ansible" }</span></li>
      <li className="quiz__choice" data-letter="D"><span className="quiz__letter">D</span><span className="quiz__text">{ "chmod -c /opt/Ansible" }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: B</p>

      <p className="quiz__why">
        { "The -R flag applies the ownership change recursively, setting both the user and group of /opt/Ansible and all files/subdirectories within it to Ansible." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="10" data-answer="A">
    <p className="quiz__stem">
      { "An administrator set up a new user account called \"test\". However, the user is unable to change their password. Given the following output: Which of the following is the most likely cause of this issue?" }
    </p>

    <pre className="quiz__exhibit">
      <code>
        { "# ls -l /bin/passwd\n-rwxr-xr-x. 1 root root 32656 Jul  9 11:24 /bin/passwd" }
      </code>
    </pre>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A" data-correct="1"><span className="quiz__letter">A</span><span className="quiz__text">{ "The SUID bit is missing on the /bin/passwd file." }</span></li>
      <li className="quiz__choice" data-letter="B"><span className="quiz__letter">B</span><span className="quiz__text">{ "The password provided by the user \"test\" does not meet complexity requirements." }</span></li>
      <li className="quiz__choice" data-letter="C"><span className="quiz__letter">C</span><span className="quiz__text">{ "The user \"test\" already changed the password today." }</span></li>
      <li className="quiz__choice" data-letter="D"><span className="quiz__letter">D</span><span className="quiz__text">{ "The password has been disabled for user \"test\"." }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: A</p>

      <p className="quiz__why">
        { "For normal users to change their own password, /bin/passwd must have the SUID bit set (permissions should be -rwsr-xr-x). The SUID bit allows users to run the program with the permissions of the file owner (root), which is required to update /etc/shadow. The provided output shows /bin/passwd does not have the SUID bit (no 's' in the owner's execute field). As a result, user \"test\" receives an \"Authentication token manipulation error\". The password can be changed as root, which confirms it's a permissions/SUID issue." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="11" data-answer="C">
    <p className="quiz__stem">
      { "A Linux administrator is changing the default system umask. The newly created files should have the -rw-r----- permission, and the newly created directories should have the drwxr----x permission. Which of the following commands should the administrator use?" }
    </p>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A"><span className="quiz__letter">A</span><span className="quiz__text">{ "umask 0035" }</span></li>
      <li className="quiz__choice" data-letter="B"><span className="quiz__letter">B</span><span className="quiz__text">{ "umask 0036" }</span></li>
      <li className="quiz__choice" data-letter="C" data-correct="1"><span className="quiz__letter">C</span><span className="quiz__text">{ "umask 0037" }</span></li>
      <li className="quiz__choice" data-letter="D"><span className="quiz__letter">D</span><span className="quiz__text">{ "umask 0038" }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: C</p>

      <p className="quiz__why">
        { "The umask value subtracts permission bits from the system defaults (- files: 0666, directories: 0777). With umask 0036 (octal): - Files get 0666 & ~0036 = 0640 → -rw-r----- - Directories get 0777 & ~0036 = 0741 → drwxr----x None of the other umask values produce both of these target permissions." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="12" data-answer="AD">
    <p className="quiz__stem">
      { "A user is experiencing issues creating files in the folder /home/testuser/testdir/. The administrator gathers the following information: Which of the following commands should the administrator use to solve the issue? (Choose two.)" }
    </p>

    <pre className="quiz__exhibit">
      <code>
        { "$ ls -ld /home/testuser/testdir/\ndrwxr-xr-x. 2 root testuser 4096 Sep  3 10:12 /home/testuser/testdir/\n$ id testuser\nuid=1001(testuser) gid=1001(testuser) groups=1001(testuser)" }
      </code>
    </pre>

    <p className="quiz__hint">Choose two.</p>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A" data-correct="1"><span className="quiz__letter">A</span><span className="quiz__text">{ "chmod u+w /home/testuser/testdir/" }</span></li>
      <li className="quiz__choice" data-letter="B"><span className="quiz__letter">B</span><span className="quiz__text">{ "chmod 770 /home/testuser/testdir/" }</span></li>
      <li className="quiz__choice" data-letter="C"><span className="quiz__letter">C</span><span className="quiz__text">{ "usermod –G root testuser" }</span></li>
      <li className="quiz__choice" data-letter="D" data-correct="1"><span className="quiz__letter">D</span><span className="quiz__text">{ "chmod g+w /home/testuser/testdir/" }</span></li>
      <li className="quiz__choice" data-letter="E"><span className="quiz__letter">E</span><span className="quiz__text">{ "usermod –G testuser root" }</span></li>
      <li className="quiz__choice" data-letter="F"><span className="quiz__letter">F</span><span className="quiz__text">{ "usermod –aG testuser testuser" }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: AD</p>

      <p className="quiz__why">
        { "The issue likely stems from the permissions on the directory /home/testuser/testdir/. The output shows that testdir has permissions of drwxr-xr-x, meaning: - The owner (root) has read, write, and execute (rwx) permissions. - The group (testuser) and others have only read and execute (r-x) permissions, but no write permission. Since the user testuser is not the owner (root) but belongs to the group testuser, they need write permissions for the group to create files. - chmod u+w /home/testuser/testdir/ - Grants write permission to the owner (root) (not effective in this case, since testuser is not root). - chmod g+w /home/testuser/testdir/ - Grants write permission to the group, allowing members of the testuser group (including the testuser account) to create files inside the directory." }
      </p>
    </div>
  </div>

  <div className="quiz__q" data-n="13" data-answer="A">
    <p className="quiz__stem">
      { "Which of the following best explains why the SUID permission is set on the /bin/passwd file?" }
    </p>

    <ul className="quiz__choices">
      <li className="quiz__choice" data-letter="A" data-correct="1"><span className="quiz__letter">A</span><span className="quiz__text">{ "To allow normal users to update the /etc/shadow file" }</span></li>
      <li className="quiz__choice" data-letter="B"><span className="quiz__letter">B</span><span className="quiz__text">{ "To ensure group permission on the /etc/passwd file stay up to date" }</span></li>
      <li className="quiz__choice" data-letter="C"><span className="quiz__letter">C</span><span className="quiz__text">{ "To indicate an attacker has compromised the system" }</span></li>
      <li className="quiz__choice" data-letter="D"><span className="quiz__letter">D</span><span className="quiz__text">{ "To mark the /bin/passwd file as immutable" }</span></li>
    </ul>

    <div className="quiz__reveal">
      <p className="quiz__verdict" />

      <p className="quiz__answer">Answer: A</p>

      <p className="quiz__why">
        { "The Set User ID (SUID) permission allows a file to execute with the privileges of the file owner, rather than the user who runs it. The /bin/passwd command is used by users to change their own passwords. The actual password hashes are stored in /etc/shadow, which is only writable by the root user. Since normal users do not have direct write permissions on /etc/shadow, the SUID bit on /bin/passwd enables the command to run with root privileges, allowing password changes." }
      </p>
    </div>
  </div>
</div>
