RHCSA RHCSA File Permissions and ACLs 3 — Questions and Answers
Question 1: Which command removes all ACL entries from the file /tmp/data.txt, reverting to standard permissions?
- setfacl -b /tmp/data.txt (Correct answer)
- setfacl -x /tmp/data.txt
- setfacl --remove-all /tmp/data.txt
- getfacl -d /tmp/data.txt
Correct answer: setfacl -b /tmp/data.txt
setfacl -b removes all extended ACL entries, leaving only the base POSIX permissions.
Question 2: When a directory has the setgid bit set, what happens to files created inside it?
- New files inherit the group ownership of the directory (Correct answer)
- New files are owned by root
- New files inherit the group of the creating user
- New files become executable automatically
Correct answer: New files inherit the group ownership of the directory
The setgid bit on a directory forces new files to inherit the directory's group rather than the creator's primary group.
Question 3: Which ls option displays a '+' symbol to indicate a file has extended ACLs?
- ls -l (Correct answer)
- ls -a
- ls -Z
- ls -n
Correct answer: ls -l
ls -l appends a '+' after the permission bits when extended ACLs are present on a file.
Question 4: A file is owned by user bob and group sales. User carol is not in group sales. Which minimal ACL command grants carol write access to the file?
- setfacl -m u:carol:w file (Correct answer)
- setfacl -m g:carol:w file
- chmod o+w file
- chown carol file
Correct answer: setfacl -m u:carol:w file
setfacl -m u:carol:w adds a user-specific ACL entry granting write permission to carol.
Question 5: What does the ACL mask entry control?
- The maximum effective permissions for named users and groups in the ACL (Correct answer)
- The default permissions assigned to new files
- The permissions of the file owner
- The permissions of the root user
Correct answer: The maximum effective permissions for named users and groups in the ACL
The ACL mask limits the maximum effective permissions granted to named users, named groups, and the owning group.
Question 6: How do you set a default ACL on directory /project so all new files automatically grant group 'devs' read-write access?
- setfacl -m d:g:devs:rw /project (Correct answer)
- setfacl -m g:devs:rw /project
- setfacl -d g:devs:rw /project
- setfacl --default g:devs:rw /project
Correct answer: setfacl -m d:g:devs:rw /project
The 'd:' prefix in setfacl -m sets a default ACL entry that is inherited by newly created files.
Question 7: A file has octal permissions 2770. What special bit is set?
- setgid (Correct answer)
- setuid
- sticky bit
- immutable bit
Correct answer: setgid
The leading '2' in octal notation represents the setgid bit.
Which command removes all ACL entries from the file /tmp/data.txt, reverting to standard permissions?