RHCSA RHCSA File Permissions and ACLs 4 — Questions and Answers
Question 1: User jane runs 'umask 077'. What permissions will a newly created directory have?
- 700 (Correct answer)
- 600
- 755
- 750
Correct answer: 700
Directories have a base of 777; subtracting umask 077 yields 700 (rwx------).
Question 2: Which command recursively sets ownership of /var/www to user apache and group apache?
- chown -R apache:apache /var/www (Correct answer)
- chmod -R apache:apache /var/www
- chgrp -R apache /var/www && chown -R apache /var/www
- usermod -d /var/www apache
Correct answer: chown -R apache:apache /var/www
chown -R user:group path recursively changes both owner and group in one command.
Question 3: Which command copies the ACL from file source.txt and applies it to dest.txt?
- getfacl source.txt | setfacl --set-file=- dest.txt (Correct answer)
- cp --acl source.txt dest.txt
- setfacl --copy source.txt dest.txt
- getfacl source.txt > dest.txt
Correct answer: getfacl source.txt | setfacl --set-file=- dest.txt
Piping getfacl output into setfacl --set-file=- is the standard method to transfer ACLs between files.
Question 4: A directory has permissions drwxrws---. What does the 's' in the group field indicate?
- The setgid bit is set on the directory (Correct answer)
- The sticky bit is set on the directory
- The setuid bit is set on the directory
- The directory is a symbolic link
Correct answer: The setgid bit is set on the directory
An 's' in the group execute position indicates the setgid bit is set and the execute bit is also set.
Question 5: What happens when you run 'chmod u+s' on an executable binary?
- The binary runs with the file owner's privileges regardless of who executes it (Correct answer)
- The binary runs with the executing user's group privileges
- The binary is restricted to root execution only
- The binary inherits the sticky bit
Correct answer: The binary runs with the file owner's privileges regardless of who executes it
The setuid bit causes an executable to run with the file owner's UID rather than the caller's UID.
Question 6: Which command removes only the ACL entry for group 'contractors' from file project.conf?
- setfacl -x g:contractors project.conf (Correct answer)
- setfacl -b g:contractors project.conf
- setfacl -m g:contractors:--- project.conf
- getfacl -x g:contractors project.conf
Correct answer: setfacl -x g:contractors project.conf
setfacl -x removes a specific named ACL entry without affecting other entries.
Question 7: A file shows permissions rw-r--r--. Which symbolic chmod command makes it executable only by the owner?
- chmod u+x file (Correct answer)
- chmod +x file
- chmod a+x file
- chmod g+x file
Correct answer: chmod u+x file
'u+x' adds execute permission exclusively for the file's owner without affecting group or other bits.
User jane runs 'umask 077'.
What permissions will a newly created directory have?