A Linux system administrator is managing a server that authenticates users against both the local /etc/passwd file and a central LDAP server. The administrator needs to verify the full password database entry for a user named rhelton. Which of the following commands would be the most reliable for retrieving this user's information, regardless of where the account is defined?
The correct command is getent passwd rhelton. The getent utility queries the databases configured in the Name Service Switch configuration file (/etc/nsswitch.conf). This allows it to retrieve entries from various sources, including local files (/etc/passwd) and network services like LDAP or NIS. Therefore, it is the most reliable command to use when the user's account could exist in either a local or a remote database. The command cat /etc/passwd | grep rhelton would only search the local password file and would fail if the user account exists only in LDAP. The id rhelton command primarily shows user and group ID numbers, not the full password file entry. The lastlog -u rhelton command displays information about the user's last login, not their account configuration details from the passwd database.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the /etc/nsswitch.conf file?
Open an interactive chat with Bash
How does the getent command work with multiple authentication sources?
Open an interactive chat with Bash
What is the difference between local and LDAP authentication?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access