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


samba (35) Versions 1.0.2

Installs/Configures samba

cookbook 'samba', '= 1.0.2', :supermarket
cookbook 'samba', '= 1.0.2'
knife supermarket install samba
knife supermarket download samba
Quality 67%

Samba Cookbook

Build Status Cookbook Version

Installs and configures Samba client or server.



  • Debian / Ubuntu derivatives
  • RedHat and derivatives

If you would like support for your preferred platform. Please think about creating a Vagrant Box and adding test platforms


  • Chef 12.1+


  • none

Known Limitations

  • Does not (yet) integrate with LDAP/AD.
  • Uses plaintext passwords for the user resource to create the SMB users if the password backend is tdbsam or smbpasswd. See below under usage.



Installs smbclient to provide access to SMB shares.


Sets up a Samba server. See below for more information on defaults.



This cookbook includes a resource/provider for managing samba users with the smbpasswd program. It will create the users home

samba_user 'jtimberman' do
  password 'plaintextpassword'
  comment 'user_name_comment'
  home '/home/jtimberman'
  shell '/bin/zsh'

This resource can only create, enable or delete the user. It only supports setting the user's initial password. It assumes a password db backend that utilizes the smbpasswd program.

This will enforce the password set by the resource. Meaning, if the local user changes their password with smbpasswd, the recipe will reset it.


samba_server 'samba server' do
  workgroup # The SMB workgroup to use, default "SAMBA".
  interfaces # Interfaces to listen on, default "lo".
  hosts_allow # Allowed hosts/networks, default "".
  bind_interfaces_only # Limit interfaces to serve SMB, default "no"
  load_printers # Whether to load printers, default "no".
  passdb_backend # Which password backend to use, default "tdbsam".
  dns_proxy # Whether to search NetBIOS names through DNS, default "no".
  security # Samba security mode, default "user".
  map_to_guest # What Samba should do with logins that don't match Unix users, default "Bad User".
  socket_options # Socket options, default "`TCP_NODELAY`"
  config_file # Location of Samba configuration, see resource for platform default
  log_dir # Location of Samba logs, see resource for platform default
  options # list of additional options, e.g. 'unix charset' => 'UTF8'.


samba_share 'Share Name' do
  guest_ok # yes, no
  printable # yes, no
  write_list # An array of Unix users
  create_mask # e.g. 0644
  directory_mask # e.g. 0700
  create_directory # Creates directory by default


The samba::default recipe includes samba::client, which simply installs smbclient package.

Create a cookbook with the server, user & share resources as if you were using any other Chef resource.

For examples see the test/fixtures/cookbooks/test directory.

Unfortunately, smbpasswd does not take a hashed password as an argument - the password is echoed and piped to the smbpasswd program. This is a limitation of Samba.


Copyright 2010-2016, Chef Software, Inc.

Copyright 2017, Webb Agile Solutions Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Samba Changelog

v1.0.2 (04-02-2017)

  • Fix #54 Add an option to not create the directory we add to the share. Useful for including Samba variables in the share name.
  • Fix #52 nmbd systemd failures in tests.

v1.0.1 (04-02-2017)

  • Fix #48 Resource underscores breaking permissions
  • Fix #47 Document proper behaviour of smbpasswd. This cookbook now enforces passwords.

v1.0.0.0 (23-01-2017)

  • New custom resources samba_server, samba_share, samba_user
  • Remove data bags!
  • Removed support for Arch & SmartOS
  • Add 12.1 compatibility requirement
  • Move attributes out of template file and into template resource
  • Use Chef built in apt-get functionality
  • Remove default recipe - having a default recipe can be misleading when it doesn't do anything.
  • Guard against nil options & shares
  • Update README with resources and give it a general tidy.
  • Remove default specs
  • Use root context for template and services
  • Use trusty not precise for building on travis-ci
  • Remove spec directory as it duplicates inspec test & doesn't test what's now in the cookbook
  • Move yum into the testing recipe to clean up dependancies.
  • Ignore FC009 as it isn't being picked up correctly.

v0.13.0 (2016-12-30)

  • This cookbook is now maintained by Sous Chefs ( Expect regular updates and quicker turnaround on PRs!
  • This will be the last version of this cookbook that supports Chef 11. Pin to this version if you require Chef 11 compatibility
  • Added node["samba"]["options"] for passing an array of additional options
  • Added node['samba']['enable_users_search'] to enable/disable searching for samba users. Defaults to true to maintain existing behavior.
  • Added SmartOS compatibility
  • Added ChefSpec matchers for the LWRP
  • Added source_url issues_url and chef_version metadata
  • Removed arch and raspbian from the metadata and added oracle. We officially support systems we can test with Test Kitchen only.
  • Added a Rakefile for simplified testing
  • Switched integration testing to Inspec from serverspec
  • Moved all testing to the 'test' cookbook and eliminated the need for the apt cookbook
  • Switched to cookstyle from Rubocop and resolved all warnings
  • Added testing in Travis CI
  • Added a kitchen config for kitchen-dokken. Expect testing in Travis using kitchen-dokken soon
  • Added a Code of Conduct doc
  • Updated the Contributing docs


  • Manage services at end of server recipe
  • Move package and service names to attributes
  • Select data bags via attributes instead of hardcoded names
  • Corrected service name on Debian
  • Add map to guest option in smb.conf
  • Add test kitchen, chefspec, serverspec, rubocop ignore rules, and foodcritic check
  • Cleanup attributes to make them easier to follow per-platform



  • [COOK-3144]: Wrong service name in samba cookbook



  • [COOK-2978]: samba cookbook has foodcritic errors


  • [COOK-1719] - Add Scientific / Amazon support to the Samba recipe


  • [COOK-1363] - user password assignment fails on systems using dash as default shell


  • Fixes COOK-802, typo in nmbd service name

Collaborator Number Metric

1.0.2 passed this metric

Foodcritic Metric

1.0.2 failed this metric

FC016: LWRP does not declare a default action: samba/resources/server.rb:1
FC016: LWRP does not declare a default action: samba/resources/share.rb:1
FC016: LWRP does not declare a default action: samba/resources/user.rb:1
Run with Foodcritic Version 8.2.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

License Metric

1.0.2 passed this metric