Difficulty: Easy
Correct Answer: /etc/nsswitch.conf
Explanation:
Introduction / Context:
Name Service Switch (NSS) lets administrators define where system lookups obtain data—local files, DNS, NIS, LDAP—and in what order. Centralizing this policy avoids editing multiple tools and ensures consistent behavior across libc-resolved queries.
Given Data / Assumptions:
Concept / Approach:
'/etc/nsswitch.conf' defines per-database lookup sequences, such as 'hosts: files dns' or 'passwd: files nis'. The resolver consults modules in the specified order until success or terminal conditions (for example, '[NOTFOUND=return]'). By contrast, '/etc/hosts' contains static host mappings; '/etc/services' maps service names to port numbers; '/etc/nsorder' is not standard on modern Linux.
Step-by-Step Solution:
Verification / Alternative check:
Use 'getent' to query databases and confirm that lookups follow the configured order. For hosts, temporarily edit '/etc/hosts' and verify precedence before DNS by querying with 'getent hosts testname'.
Why Other Options Are Wrong:
Common Pitfalls:
Misordering sources causing slow lookups (for example, DNS before files for localhost), or forgetting to install the corresponding NSS modules for NIS/LDAP.
Final Answer:
/etc/nsswitch.conf
Discussion & Comments