LCA User & Permission Management 2 — Questions and Answers
Question 1: Which file stores the encrypted password hashes for local user accounts on a Linux system?
- /etc/passwd
- /etc/shadow (Correct answer)
- /etc/group
- /etc/gshadow
Correct answer: /etc/shadow
/etc/shadow stores hashed passwords and password aging info, readable only by root.
Question 2: What command changes the group ownership of a file named report.txt to the group 'finance'?
- chown :finance report.txt (Correct answer)
- chmod g=finance report.txt
- chgrp -u finance report.txt
- usermod -g finance report.txt
Correct answer: chown :finance report.txt
chown :groupname file changes only the group owner of a file.
Question 3: A file has permissions -rwsr-xr-x. What does the 's' in the owner execute position indicate?
- Sticky bit is set
- SGID bit is set
- SUID bit is set (Correct answer)
- The file is a symbolic link
Correct answer: SUID bit is set
An 's' replacing the owner execute bit means the SUID bit is set, causing the file to run as its owner.
Question 4: Which command locks a user account by prepending '!' to the password hash in /etc/shadow?
- usermod -L username (Correct answer)
- passwd -d username
- chage -E 0 username
- userdel -r username
Correct answer: usermod -L username
usermod -L locks an account by inserting '!' before the password hash, preventing password-based login.
Question 5: What octal permission value sets read+write for owner, read-only for group, and no permissions for others?
- 644
- 640 (Correct answer)
- 620
- 660
Correct answer: 640
640 = owner rw- (6), group r-- (4), others --- (0).
Question 6: Which /etc/shadow field controls the maximum number of days a password is valid before it must be changed?
- Field 4 (minimum days)
- Field 5 (maximum days) (Correct answer)
- Field 6 (warning days)
- Field 7 (inactive days)
Correct answer: Field 5 (maximum days)
Field 5 in /etc/shadow specifies the maximum password age in days.
Question 7: A directory has the sticky bit set (drwxrwxrwt). What restriction does this impose?
- Only root can delete files in it
- Users can only delete files they own (Correct answer)
- No new files can be created in it
- Files inherit the directory's group
Correct answer: Users can only delete files they own
The sticky bit on a directory prevents users from deleting or renaming files owned by others, even with write access.
Which file stores the encrypted password hashes for local user accounts on a Linux system?