RHCSA RHCSA File Permissions and ACLs 2 — Questions and Answers
Question 1: A file has permissions rwxr-x---. Which octal notation represents this?
- 750 (Correct answer)
- 755
- 740
- 760
Correct answer: 750
rwx=7, r-x=5, ---=0 combines to octal 750.
Question 2: Which command removes the execute permission for 'others' on a file named script.sh?
- chmod o-x script.sh (Correct answer)
- chmod a-x script.sh
- chmod u-x script.sh
- chmod g-x script.sh
Correct answer: chmod o-x script.sh
'o' targets the 'others' category and '-x' removes the execute bit.
Question 3: What does the sticky bit do when set on a directory?
- Only the file owner or root can delete files within the directory (Correct answer)
- Files in the directory cannot be executed
- All files inherit the directory's group ownership
- The directory cannot be renamed by non-owners
Correct answer: Only the file owner or root can delete files within the directory
The sticky bit prevents users from deleting files they don't own inside a shared directory.
Question 4: A user wants to set an ACL so that user 'alice' has read-only access to /data/report.txt. Which command is correct?
- setfacl -m u:alice:r /data/report.txt (Correct answer)
- setfacl -x u:alice:r /data/report.txt
- getfacl -m u:alice:r /data/report.txt
- chmod u:alice:r /data/report.txt
Correct answer: setfacl -m u:alice:r /data/report.txt
setfacl -m modifies (adds/changes) an ACL entry; u:alice:r grants read to alice.
Question 5: Which command displays the ACL entries for the file /etc/myconfig?
- getfacl /etc/myconfig (Correct answer)
- setfacl -l /etc/myconfig
- ls -acl /etc/myconfig
- stat --acl /etc/myconfig
Correct answer: getfacl /etc/myconfig
getfacl prints the access control list entries for a file or directory.
Question 6: What is the effect of running 'chmod 4755 /usr/bin/newprog'?
- Sets the setuid bit and makes the file rwxr-xr-x (Correct answer)
- Sets the sticky bit and makes the file rwxr-xr-x
- Sets the setgid bit and makes the file rwxr-xr-x
- Sets the setuid bit and makes the file rw-r--r--
Correct answer: Sets the setuid bit and makes the file rwxr-xr-x
A leading 4 in octal notation sets the setuid bit; 755 gives rwxr-xr-x permissions.
Question 7: A new file is created by a user whose umask is 027. What are the default permissions on the file?
- 640 (Correct answer)
- 750
- 644
- 755
Correct answer: 640
Files start with base 666; subtracting umask 027 yields 640 (rw-r-----).
A file has permissions rwxr-x---.
Which octal notation represents this?