Where Is the Linux nsswitch.conf File?
Linux /etc/nsswitch.conf controlling passwd, group, hosts and DNS lookup order.
Last updated
Linux decides where users, groups and hostnames resolve from through nsswitch.conf, ordering files, DNS, LDAP and systemd sources per database. One wrong hosts line explains mysterious resolution failures.
Enterprise joins edit passwd and group lines for directory logins. Test changes with getent before logging out or lockouts follow.
Where Linux stores this, by platform
/etc/nsswitch.conf
Per-database source lists like hosts: files dns myhostname. Back up before editing; a broken passwd line locks out logins. Verify with getent passwd and getent hosts after changes.
Frequently asked questions
Why does Linux ignore my DNS server?
The hosts line in the file above likely lists files first with a stale /etc/hosts entry winning. Reorder or fix the hosts file.
How do I enable LDAP logins?
Add the directory source to passwd, group and shadow lines above plus the client config. Test with getent before closing the root session.
Notice an outdated path? Let us know.