Bird
0
0

You want to write a script that disables a user by setting their shell to /usr/sbin/nologin. Which file and field must you modify?

hard📝 Application Q9 of 15
Linux CLI - Users and Groups
You want to write a script that disables a user by setting their shell to /usr/sbin/nologin. Which file and field must you modify?
AModify /etc/passwd, seventh field (shell)
BModify /etc/shadow, second field (password)
CModify /etc/group, fourth field (users)
DModify /etc/passwd, third field (UID)
Step-by-Step Solution
Solution:
  1. Step 1: Identify the shell field in /etc/passwd

    The seventh field in /etc/passwd specifies the user's default shell.
  2. Step 2: Changing shell to /usr/sbin/nologin disables login

    Setting this field to /usr/sbin/nologin prevents user login without changing password.
  3. Final Answer:

    Modify /etc/passwd, seventh field (shell) -> Option A
  4. Quick Check:

    Disable login by changing shell in /etc/passwd [OK]
Quick Trick: User shell is the seventh field in /etc/passwd [OK]
Common Mistakes:
  • Trying to modify /etc/shadow password field
  • Changing UID instead of shell
  • Editing /etc/group which controls groups

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes