CompTIA Linux+ (XK0-005) — Question 296
Joe, a user, is unable to log in to the system. The Linux administrator checks the /etc/passwd file and reviews the following output:
Joe:x:1002:1002::/home/Joe:/sbin/nologin
Which of the following should the administrator do to fix this issue?
Answer options
- A. Remove the x entry in the /etc/passwd file for Joe.
- B. Change the /sbin/nologin entry to /bin/sh for Joe.
- C. Issue the usermod -L Joe command.
- D. Ensure that a corresponding entry is in the /etc/shadow file for Joe.
Correct answer: B
Explanation
The correct action is to change the login shell from /sbin/nologin to /bin/sh, which will allow Joe to log in. Removing the x entry would compromise the password mechanism, while issuing the usermod -L command would lock the account, and ensuring an entry in /etc/shadow does not directly resolve the login issue.