010-160 System Security & User Permissions 2 — Questions and Answers
Question 1: Which command displays the current user's group memberships?
- whoami
- id
- groups (Correct answer)
- passwd
Correct answer: groups
The `groups` command lists all groups the current user belongs to.
Question 2: What does the sticky bit do when set on a directory?
- Prevents the directory from being deleted
- Allows only the file owner to delete files within it (Correct answer)
- Makes all files executable
- Prevents new files from being created
Correct answer: Allows only the file owner to delete files within it
The sticky bit on a directory restricts file deletion so only the file's owner (or root) can remove it.
Question 3: Which numeric permission value grants read, write, and execute to the owner only?
- 644
- 755
- 700 (Correct answer)
- 777
Correct answer: 700
700 gives rwx (7) to the owner and no permissions (0,0) to group and others.
Question 4: What is the purpose of the /etc/shadow file?
- Stores group definitions
- Holds encrypted user passwords (Correct answer)
- Lists sudo privileges
- Tracks login history
Correct answer: Holds encrypted user passwords
/etc/shadow stores hashed passwords and password aging information, readable only by root.
Question 5: Which command changes the group ownership of a file?
- chown
- chmod
- chgrp (Correct answer)
- usermod
Correct answer: chgrp
`chgrp` changes the group owner of a file or directory.
Question 6: A file has permissions -rwxr-x---. Which class has no access at all?
- Owner
- Group
- Others (Correct answer)
- Root
Correct answer: Others
The last three dashes (---) represent 'others', meaning they have no read, write, or execute permissions.
Question 7: What does the SUID bit do when set on an executable file?
- Runs the file as the file's owner regardless of who executes it (Correct answer)
- Prevents the file from being modified
- Grants write access to all users
- Sets the file as immutable
Correct answer: Runs the file as the file's owner regardless of who executes it
The Set User ID (SUID) bit causes the file to execute with the privileges of its owner rather than the caller.
Which command displays the current user's group memberships?