nscd.conf(5)
๐ nscd.conf โ the name service cache daemon config file, explained fr
okay so bestie, gather round ๐ซถ this is the man page for nscd.conf โ aka the name service cache daemon configuration file, and it's genuinely not that deep once you get the vibe. let's go โจ
โจ NAME โจ
nscd.conf โ the config file for the name service cache daemon, no cap ๐ธ
๐ SYNOPSIS ๐
/etc/nscd.conf
๐ DESCRIPTION ๐
so the file /etc/nscd.conf gets read by nscd(8) at startup, periodt. every line in it is either an attribute + a value, or an attribute + a service + a value. the fields are separated by either SPACE or TAB characters โ pick your fighter ๐
. and a # (number sign) starts a comment: everything after it, all the way to the end of the line, is not interpreted by nscd. it's giving "the rest is silence" ๐
the valid services are passwd, group, hosts, services, and netgroup. those five, that's the list, memorise it ๐ฆ
๐ง the attributes, one by one (yes, all of them)
logfiledebug-file-name โ specifies the name of the file that debug info should be written to. that's it, that's the whole thing ๐debug-levelvalue โ sets how much debug tea gets spilled.0hides debug info entirely (mysterious, love that).1shows general debug info.2additionally shows data in cache dumps.3(and above, go off) shows all debug info. the default is0๐threadsnumber โ the initial number of threads started to sit around waiting for requests. important: at least five threads will always be created โ that's a floor, not a suggestion, bestie. the number of threads may grow dynamically up tomax-threadsin response to client demand, but it never decreases. literally never. it's committed ๐ซถmax-threadsnumber โ the ceiling on thread count. the default is32๐ฅserver-useruser โ if you set this,nscdruns as this user instead ofroot. caveat time: if a separate cache for every user is being used (the-Sparameter), this option is ignored. sorry babe ๐stat-useruser โ specifies the user who's allowed to request statistics. the stats are for them and only them ๐reload-countunlimited | number โ sets a limit on how many times a cached entry gets reloaded without being used before it gets removed. limit can range from0to254; values255or higher behave the same asunlimited. you can write limit values in decimal, or in hex with a0xprefix. the special valueunlimitedis case-insensitive (soUnlimitedslaps too). the default limit is5. a limit of0turns the reloading feature off. also โ go read NOTES below, the reloading discussion is required reading fr fr ๐paranoia<yes|no>โ enabling paranoia mode makesnscdrestart itself periodically. it's not paranoia if they're literally out to get you, bestie. the default isno๐ญrestart-intervaltime โ sets the restart interval to time seconds, but only if periodic restart is enabled by enabling paranoia mode. the default is3600โญenable-cacheservice<yes|no>โ turns the cache for the specified service on or off. the default isno๐positive-time-to-liveservice value โ sets the TTL (time-to-live) for positive entries (successful queries) in the specified cache for service. value is in seconds. bigger values mean higher cache hit rates and lower mean response times, but more cache coherence problems โ it's a trade-off, everything is ๐ . note that for some name services (including specifically DNS) the TTL returned from the name service is used, and this attribute is ignored entirely.negative-time-to-liveservice value โ sets the TTL (time-to-live) for negative entries (unsuccessful queries) in the specified cache for service. value is in seconds. this can give significant performance improvements if you have several files owned by UIDs (user IDs) that aren't in the system databases โ for example, untarring the Linux kernel sources as root ๐ฎโ๐จ โ but it should be kept small to reduce cache coherency problems. small. tiny. keep it lowkey.suggested-sizeservice value โ this is the internal hash table size. value should stay a prime number for optimum efficiency like the good little prime it is. the default is211๐check-filesservice<yes|no>โ enables or disables checking whether the file belonging to the specified service has changed. the files in question are/etc/passwd,/etc/group,/etc/hosts,/etc/resolv.conf,/etc/services, and/etc/netgroup. the default isyesโจpersistentservice<yes|no>โ keeps the content of the cache for service across server restarts. useful when paranoia mode is set. the default isno๐ฆsharedservice<yes|no>โ makes the memory mapping of thenscddatabases for service shared with the clients, so they can search in them directly instead of asking the daemon over the socket every single time a lookup happens. the default isno. heads up though: a cache miss will still result in asking the daemon over the socket โ shared doesn't save you there ๐max-db-sizeservice bytes โ the maximum allowable size, in bytes, of the database files for service. the default is33554432๐ฅauto-propagateservice<yes|no>โ when set tonofor thepasswdorgroupservice, the.bynamerequests are not added to thepasswd.byuidorgroup.bygidcache. this can help with tables containing multiple records for the same ID (messy messy, we've all been there). the default isyes. this option is valid only for the servicespasswdandgroupโ don't try it anywhere else, it's not for them ๐
๐ธ NOTES ๐ธ
the default values stated in this manual page come from the source code of nscd(8) and get used if you don't override them in the config file. that said, the default values in your distribution's config file might differ โ distributions love doing their own thing, iykyk ๐
๐ Reloading
nscd(8) has a feature called reloading, and its behaviour can be, um, surprising. buckle up bestie โจ
reloading is enabled when the reload-count attribute has a non-zero value. the default value in the source code enables reloading, although your distribution may differ ๐ซถ
when reloading is enabled, positive cached entries (the results of successful queries) do not simply expire when their TTL is up. instead, at the expiry time, nscd will "reload" โ meaning it re-issues to the name service the exact same query that created the cached entry, to get a new value to cache. depending on /etc/nsswitch.conf, this may mean a DNS, LDAP, or NIS request gets made. if the new query succeeds, reloading repeats when the new value would expire, until reload-count reloads have happened for the entry โ and only then does it actually get removed from the cache. a request from a client that hits the entry will reset the reload counter on that entry. and purging the cache using nscd -i overrides the reload logic and removes the entry, no negotiation ๐
so reloading has the effect of extending cache entry TTLs without compromising on cache coherency โ at the cost of additional load on the backing name service. whether that's a good idea on your system depends on details of your applications' behaviour, your name service, and the effective TTL values of your cache entries. also note: for some name services (DNS, for example), the effective TTL is the value returned from the name service, not the value of the positive-time-to-live attribute ๐ฅ
please consider the following advice carefully, this is the important part:
- if your application will make a second request for the same name, after more than 1 TTL but before
reload-countTTLs, and is sensitive to the latency of a cache miss โ then reloading may be a good idea for you ๐ - if your name service is configured to return very short TTLs, and your applications only make requests rarely under normal circumstances, then reloading may result in additional load on your backing name service without any benefit to applications โ which is probably a bad idea for you ๐ญ
- if your name service capacity is limited, reloading may have the surprising effect of increasing load on your name service instead of reducing it, and may be a bad idea for you ๐
- setting
reload-counttounlimitedis almost never a good idea, because it results in a cache that never expires entries and puts never-ending additional load on the backing name service. like, just don't ๐ซถ
some distributions have an init script for nscd(8) with a reload command which uses nscd -i to purge the cache. that use of the word "reload" is entirely different from the "reloading" described here โ same word, different vibe, don't get it twisted ๐
๐ฆ SEE ALSO ๐ฆ
okay that's the whole page, you ate that bestie ๐ this gem is from Linux man-pages 6.18, dated 2026-02-08 โ go forth and cache responsibly ๐โจ๐
๐ฆ where this page comes from
- alpine 3.24: man-pages 6.18-r0 ยท GPL-2.0-or-later
- nixos 26.05: man-pages 6.18
- ๐ the page's license: GPL-2.0-or-later
- Copyright 1999-2000, SuSE GmbH
- Copyright 2021, Microsoft Corp
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms