Linux CLI - Users and GroupsYou 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)Check Answer
Step-by-Step SolutionSolution:Step 1: Identify the shell field in /etc/passwdThe seventh field in /etc/passwd specifies the user's default shell.Step 2: Changing shell to /usr/sbin/nologin disables loginSetting this field to /usr/sbin/nologin prevents user login without changing password.Final Answer:Modify /etc/passwd, seventh field (shell) -> Option AQuick 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 fieldChanging UID instead of shellEditing /etc/group which controls groups
Master "Users and Groups" in Linux CLI9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Linux CLI Quizzes File Permissions and Ownership - chown (change ownership) - Quiz 4medium File and Directory Operations - rm (remove files) - Quiz 15hard File and Directory Operations - touch (create empty files) - Quiz 7medium File and Directory Operations - Why file management is daily work - Quiz 9hard Linux Basics and Terminal - Shell concept (Bash, Zsh) - Quiz 4medium Navigating the File System - pwd (print working directory) - Quiz 6medium Navigating the File System - Tab completion - Quiz 6medium Viewing and Editing Files - head and tail - Quiz 8hard Viewing and Editing Files - head and tail - Quiz 1easy Viewing and Editing Files - tail -f for live log monitoring - Quiz 7medium