LFCS Certification Filesystem Permissions and ACLs 2 — Questions and Answers
Question 1: Which command displays the ACL entries for a file named 'report.txt'?
- getfacl report.txt (Correct answer)
- listacl report.txt
- acl -l report.txt
- showacl report.txt
Correct answer: getfacl report.txt
getfacl reads and displays the Access Control List for a specified file or directory.
Question 2: A directory has permissions 'drwxrwxrwt'. What does the 't' (sticky bit) prevent?
- Users from deleting files owned by other users (Correct answer)
- Files from being executed
- Users from reading files owned by others
- Group members from writing new files
Correct answer: Users from deleting files owned by other users
The sticky bit on a directory restricts file deletion so only the file owner, directory owner, or root can remove files.
Question 3: What does the command 'setfacl -m u:alice:rx file.sh' do?
- Grants alice read and execute permissions on file.sh via ACL (Correct answer)
- Removes alice's ACL entry from file.sh
- Sets the default ACL for alice on file.sh
- Changes file.sh ownership to alice
Correct answer: Grants alice read and execute permissions on file.sh via ACL
setfacl -m modifies (adds or updates) an ACL entry; u:alice:rx grants user alice read and execute access.
Question 4: Which octal value represents 'rwxr-x---' permissions?
- 750 (Correct answer)
- 755
- 740
- 760
Correct answer: 750
rwx=7, r-x=5, ---=0, so the combined octal is 750.
Question 5: A file has an ACL mask of 'r--'. A group ACL entry grants 'rwx'. What effective permissions does the group have?
- r-- (Correct answer)
- rwx
- r-x
- ---
Correct answer: r--
The ACL mask limits the effective permissions of named users and groups; the effective permission is the intersection of the entry and the mask.
Question 6: How do you remove all ACL entries (including defaults) from a directory 'mydir'?
- setfacl -b mydir (Correct answer)
- setfacl -x mydir
- setfacl --remove-all mydir
- getfacl --clear mydir
Correct answer: setfacl -b mydir
setfacl -b removes all extended ACL entries, restoring only the base POSIX permissions.
Question 7: Which command would set the setuid bit on an executable 'myapp' using symbolic notation?
- chmod u+s myapp (Correct answer)
- chmod g+s myapp
- chmod +t myapp
- chmod o+s myapp
Correct answer: chmod u+s myapp
chmod u+s sets the setuid bit on the user (owner) permission triplet, causing the file to run with the owner's privileges.
Which command displays the ACL entries for a file named 'report.txt'?