010-160 File Permissions and Ownership 5 — Questions and Answers
Question 1: Which file stores the mapping between usernames and UIDs on a Linux system?
- /etc/passwd (Correct answer)
- /etc/shadow
- /etc/group
- /etc/users
Correct answer: /etc/passwd
/etc/passwd contains user account information including username-to-UID mappings.
Question 2: A script has permissions -rwxr-xr-x. A user in the file's group runs it. What can they do?
- Execute the script (Correct answer)
- Execute and modify the script
- Only read the script
- Nothing — group has no execute permission
Correct answer: Execute the script
The group permissions are r-x, which includes execute, so group members can run the script.
Question 3: What does 'chown alice:developers report.txt' accomplish?
- Sets owner to alice and group to developers (Correct answer)
- Sets owner to alice and removes group
- Sets group to developers and leaves owner unchanged
- Renames the file to developers
Correct answer: Sets owner to alice and group to developers
The user:group syntax in chown sets both the owner (alice) and the group (developers) simultaneously.
Question 4: Which symbolic chmod expression removes all permissions for others?
- o=
- o-rwx
- o=---
- Both A and B (Correct answer)
Correct answer: Both A and B
Both 'o=' (assign nothing) and 'o-rwx' (remove all) result in no permissions for others.
Question 5: How can you view the groups a user belongs to?
- groups username
- cat /etc/group | grep username
- id username
- All of the above (Correct answer)
Correct answer: All of the above
All three commands can show group membership: 'groups', 'id', and inspecting /etc/group all work.
Question 6: A directory has permissions drwx------. What can a non-owner, non-root user do with it?
- Nothing — they cannot read, write, or enter it (Correct answer)
- List files but not enter
- Enter but not list files
- Read files if they know the filename
Correct answer: Nothing — they cannot read, write, or enter it
With no permissions for group or others (------), non-owners have no access to the directory at all.
Question 7: What is the purpose of the /etc/group file?
- Maps group names to GIDs and lists group members (Correct answer)
- Stores encrypted group passwords only
- Defines default permissions for new groups
- Controls which groups can use sudo
Correct answer: Maps group names to GIDs and lists group members
/etc/group maps group names to GIDs and lists the supplementary members of each group.
Which file stores the mapping between usernames and UIDs on a Linux system?