Notes on NSS Configuration File (The GNU C Library)

#### 30.2.3 Notes on the NSS Configuration File ¶

Finally a few more hints. The NSS implementation is not completely helpless if `/etc/nsswitch.conf` does not exist. For all supported databases there is a default value so it should normally be possible to get the system running even if the file is corrupted or missing.

For the `hosts` and `networks` databases the default value is `files dns`. I.e., local configuration will override the contents of the domain name system (DNS).

The `passwd`, `group`, and `shadow` databases was traditionally handled in a special way. The appropriate files in the `/etc` directory were read but if an entry with a name starting with a `+` character was found NIS was used. This kind of lookup was removed and now the default value for the services is `files`. libnss_compat no longer depends on libnsl and can be used without NIS.

For all other databases the default value is `files`.

A second point is that the user should try to optimize the lookup process. The different service have different response times. A simple file look up on a local file could be fast, but if the file is long and the needed entry is near the end of the file this may take quite some time. In this case it might be better to use the `db` service which allows fast local access to large data sets.

Often the situation is that some global information like NIS must be used. So it is unavoidable to use service entries like `nis` etc. But one should avoid slow services like this if possible.