010-160 System Security & User Permissions 3 — Questions and Answers
Question 1: Which file defines which users and groups can use sudo?
- /etc/sudoers (Correct answer)
- /etc/sudo.conf
- /etc/pam.d/sudo
- /etc/security/sudo
Correct answer: /etc/sudoers
/etc/sudoers (edited safely with visudo) controls sudo access policies.
Question 2: How would you add an existing user 'alice' to the 'wheel' group without removing her from other groups?
- usermod -g wheel alice
- usermod -aG wheel alice (Correct answer)
- groupadd wheel alice
- gpasswd wheel alice
Correct answer: usermod -aG wheel alice
`usermod -aG wheel alice` appends (-a) alice to the supplementary group (-G) wheel.
Question 3: What does 'umask 027' mean for newly created files?
- Files get permissions 027
- Files get permissions 640 (Correct answer)
- Files get permissions 750
- Files get permissions 777
Correct answer: Files get permissions 640
Default file permissions (666) minus umask (027) = 640, giving rw-r----- for new files.
Question 4: Which command locks a user account so they cannot log in with a password?
- userdel -l username
- usermod -L username (Correct answer)
- passwd -d username
- chage -E 0 username
Correct answer: usermod -L username
`usermod -L username` locks the account by prepending a '!' to the password hash in /etc/shadow.
Question 5: In the output of `ls -l`, what does the first character 'd' indicate?
- The item is a device file
- The item is a directory (Correct answer)
- The item is a symbolic link
- The item has the SUID bit set
Correct answer: The item is a directory
A 'd' as the first character of the permission string indicates the item is a directory.
Question 6: What is the numeric (octal) representation of permissions rwxr-xr-x?
- 744
- 755 (Correct answer)
- 775
- 654
Correct answer: 755
rwx=7, r-x=5, r-x=5 → 755.
Question 7: Which command shows failed login attempts on a Linux system?
- lastb (Correct answer)
- lastlog
- who -f
- w -b
Correct answer: lastb
`lastb` reads /var/log/btmp and displays a list of failed login attempts.
Which file defines which users and groups can use sudo?