Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


nscd (24) Versions 6.0.3

Installs and configures nscd

cookbook 'nscd', '= 6.0.3', :supermarket
cookbook 'nscd', '= 6.0.3'
knife supermarket install nscd
knife supermarket download nscd
Quality 50%

nscd Cookbook

Cookbook Version
CI State

Installs and configures name service cache daemon (nscd). Provides a custom resource for clearing nscd database caches.


This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit or come chat with us on the Chef Community Slack in #sous-chefs.



  • Debian 9+
  • Ubuntu 18.04+
  • RHEL/CentOS 7+
  • openSUSE
  • Fedora
  • SmartOS


  • Chef 12.5+


  • none


  • default['nscd']['template_cookbook'] - nscd cookbook name. You can override this attribute if you want to pass in a custom template for nscd.conf
  • default['nscd']['package'] - nscd package name, defaults to nscd. Other variants include: unscd, gnscd
  • default['nscd']['version'] - nscd version, defaults to nil. If set to nil, the latest will be installed.

The following attributes affect configuration of /etc/nscd.conf.

  • default['nscd']['logfile']. Specifies name of the file to which debug info should be written. Default /var/log/nscd
  • default['nscd']['threads']. This is the number of threads that are started to wait for requests. At least five threads will always be created. Default 4
  • default['nscd']['max_threads']. Specifies the maximum number of threads. Default 32
  • default['nscd']['server_user']. If this option is set, nscd will run as this user and not as root. If a separate cache for every user is used (-S parameter), this option is ignored. Default nscd
  • default['nscd']['stat_user']. Specifies the user who is allowed to request statistics. Default root
  • default['nscd']['debug_level']. Sets the desired debug level. Default 0
  • default['nscd']['reload_count']. Limit on the number of times a cached entry gets reloaded without being used before it gets removed. Default 5
  • default['nscd']['paranoia']. Enabling paranoia mode causes nscd to restart itself periodically. Default no
  • default['nscd']['restart_interval']. Sets the restart interval to time seconds if periodic restart is enabled by enabling paranoia mode. Default 3600
  • default['nscd']['databases']. List of databases to configure. Default %[passwd group hosts services netgroup]

Each database has attributes, default depends on SERVICE, see attribute file.

  • default['nscd'][SERVICE]['enable_cache']. Enables or disables the specified SERVICE cache.
  • default['nscd'][SERVICE]['positive_time_to_live']. Sets the TTL (time-to-live) for positive entries (successful queries) in the specified cache for service. Value is in seconds. Larger values increase cache hit rates and reduce mean response times, but increase problems with cache coherence.
  • default['nscd'][SERVICE]['negative_time_to_live']. Sets the TTL (time-to-live) for negative entries (unsuccessful queries) in the specified cache for service. Value is in seconds. Can result in significant performance improvements if there are several files owned by UIDs (user IDs) not in system databases (for example untarring the Linux kernel sources as root); should be kept small to reduce cache coherency problems.
  • default['nscd'][SERVICE]['suggested_size']. This is the internal hash table size, value should remain a prime number for optimum efficiency.
  • default['nscd'][SERVICE]['check_files']. Enables or disables checking the file belonging to the specified service for changes. The files are /etc/passwd, /etc/group, /etc/hosts, /etc/services and /etc/netgroup.
  • default['nscd'][SERVICE]['persistent']. Keep the content of the cache for service over server restarts; useful when paranoia mode is set.
  • default['nscd'][SERVICE]['shared']. The memory mapping of the nscd databases for service is shared with the clients so that they can directly search in them instead of having to ask the daemon over the socket each time a lookup is performed.
  • default['nscd'][SERVICE]['max_db_size']. The maximum allowable size, in bytes, of the database files for the service.
  • default['nscd'][SERVICE]['auto_propagate']. When set to no for passwd or group service, then the .byname requests are not added to passwd.byuid or group.bygid cache. This can help with tables containing multiple records for the same ID. This option is valid only for services passwd and group.



Installs nscd, manages the nscd service and makes available commands to clear the nscd databases (passwd and group) so they can be notified in other recipes (such as when managing openldap).


clear_cache The clear_cache custom resource provides a simple way to clear the cache of 1 or more nscd databases from other recipes.


  • :clear: clears the nscd database cache


  • databases: Array of nscd databases (defaults to passwd group hosts services, and netgroup)


Clearing caches of passwd, and group databases

nscd_clear_cache 'clear-nscd-caches' do
  databases %w(passwd group)

Clearing caches of passwd, and group databases via notification so the databases are only cleared when another change is made.

nscd_clear_cache 'clear-nscd-caches' do
  databases %w(passwd group)
  action :nothing

template '/etc/nsswitch.conf' do
  notifies :clear, 'nscd_clear_cache[clear-nscd-caches]', :immediately


If you're using nscd, add this recipe. If you need to clear database cache within other recipes using the nscd_clear_cache custom resource.

Note: Version 2.0 of this cookbook replaces notifying execute resource for clearing caches with the nscd_clear_cache custom resource.


This project exists thanks to all the people who contribute.


Thank you to all our backers!


Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

nscd Cookbook CHANGELOG

This file is used to list changes made in each version of the nscd cookbook.

6.0.3 - 2022-02-08

  • Remove delivery folder

6.0.2 - 2021-08-31

  • Standardise files with files in sous-chefs/repo-management

6.0.1 - 2021-06-01

  • Standardise files with files in sous-chefs/repo-management

6.0.0 - 2021-05-25

  • Enable unified_mode
  • Bump chef_version constraint to >= 15.3

5.2.0 - 2021-02-26

  • Sous Chefs Adoption
  • Cookstyle fixes

5.1.0 (2019-09-30)

  • The running user is now calculated at converge time which prevents failures on systems that don't have the nscd package before the chef-client run has started.
  • Columns in the config are now somewhat aligned, which prevents a hard to read diff on the first chef-client run
  • Added Ubuntu 18.04 / Debian 10 testing to Travis
  • Added support and testing for openSUSE 42 / 15

5.0.2 (2018-04-04)

  • Remove apt from the Berksfile
  • Travis: Test the custom resource and test Debian
  • Resolve Chef 14 deprecation

5.0.1 (2018-02-15)

  • Test with delivery local mode and cleanup the test cookbook
  • Don't use kind_of in the custom resource (FC117)
  • Fix a bad example in the readme

5.0.0 (2017-02-23)

  • Require Chef 12.5+ and remove compat_resource dependency

v4.1.0 (2016-06-10)

  • Add a new attribute 'template_cookbook' to allow specifying a cookbook containing the nscd config template for wrapper cookbooks

v4.0.0 (2016-05-12)

  • The NSCD user / group is now set to nscd if the nscd user/group exist and if not it will run as nobody. This is most likely the desired behavior for users, but may be a surprise based on the previous behavior.

v3.0.0 (2016-04-29)

  • NSCD database values are now sanitized to remove incompatible databases on RHEL < 6 and Debian < 8. services and netgroup will now be removed as necessary

v2.0.0 (2015-10-24)

  • Breaking change: Changed the execute block for performing nscd database cache clears in wrapper cookbooks to a Chef 12.5 custom resource that can more easily clear the cache for multiple databases. This will require updating cookbooks that notified to the previous execute block and requires Chef 12.0 or greater.

v1.0.1 (2015-10-24)

  • Added additional platforms added to Test Kitchen config
  • Added the standard Chef Rubocop config
  • Updated Travis CI to use Chef DK for testing instead of Gems
  • Updated contributing and testing docs
  • Updated testing deps in the Gemfile
  • Added maintainers.toml and
  • Added a Rakefile for simplified testing
  • Updated links to the Github org to point to the new chef-cookbooks org

v1.0.0 (2015-09-05)

  • Minimum supported Chef release is now 11
  • Added default['nscd']['version'] to control the version of the nscd package to install
  • Removed use of Ruby 1.8.7 hash rockets
  • Added source_url and issue_url metadata
  • Added additional platforms to the Kitchen CI config
  • Removed Ruby 1.9.3 from Travis CI and add 2.1 and 2.2
  • Removed the version constraint on apt in the Berkshelf file
  • Updated developent dependencies and break Gemfile into groups
  • Added cookbook version badge to the readme


  • Template the nscd config before starting the service so we don't have to start then restart
  • Added a chefignore file
  • Added Fedora as supported in metadata / Readme
  • Update testing and contributing docs to match JIRA-free process
  • Update development dependencies to current versions (chefspec, berkshelf, foodcritic, test kitchen, and rubocop)
  • Update chefspec / server spec to work with the newer releases
  • Add Trusty to the test kitchen config


  • Manage /etc/nscd.conf with a template



  • COOK-3607 - Add support for different nscd packages





  • [COOK-1915] - Support SmartOS for nscd


  • [COOK-1993] - use install action for packages


  • Current public release

Collaborator Number Metric

6.0.3 passed this metric

Contributing File Metric

6.0.3 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Cookstyle Metric

6.0.3 passed this metric

No Binaries Metric

6.0.3 passed this metric

Testing File Metric

6.0.3 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Version Tag Metric

6.0.3 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must include a tag that matches this cookbook version number