Forge Home


htpasswd module


1,564,682 latest version

2.5 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.0.3 (latest)
  • 0.0.2
  • 0.0.1
released Aug 27th 2014
This version is compatible with:
  • Puppet 3.x

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'leinaddm-htpasswd', '0.0.3'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add leinaddm-htpasswd
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install leinaddm-htpasswd --version 0.0.3

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.



leinaddm/htpasswd — version 0.0.3 Aug 27th 2014


Puppet module to manage htpasswd and htgroup files.

This module has the ability to manage users with the same username in multiple files. To be able to do this it uses the same approach that the builtin cron type uses with cronjobs: a marker comment before the managed entry. This means that you can not use this module to manage or remove existing entries in htpasswd files. If you need to manage exiting entries you can use , but your usernames will have to be unique across all managed htpasswd files on the same host.

This module does not manage the owner/group/mode of the htpasswd and htgroup files you specify. You have to use a separate file resource for that (see here for an explanation).


Puppet v3.x with Ruby v1.8.7, v1.9.3, v2.0.0

htpasswd type

add a user

htpasswd { 'dan':
  cryptpasswd => 'MrC7Aq3qPKPaK',  # encrypted password
  target      => '/etc/httpd/conf/htpasswd',

add a second user with the same username to a different file

htpasswd { 'dan2':
  username    => 'dan',
  cryptpasswd => 'djkhfsdhfkjsd',  # encrypted password
  target      => '/etc/httpd/conf/htpasswd2',

remove a user

htpasswd { user:
  ensure => absent,
  target => '/etc/httpd/conf/htpasswd',

htgroup type

add a group

htgroup { groupname:
  users  => [ user1, user2, ],
  target => '/etc/httpd/conf/htgroup',

remove a group

htgroup { groupname:
  ensure => absent,
  target => '/etc/httpd/conf/htgroup',

helper parser functions

ht_crypt('password', 'salt')

encrypt 'password' with 'salt' using the crypt method

ht_md5('password', 'salt')

encrypt 'password' with 'salt' using the apache MD5 method


encrypt 'password' using the apache SHA1 method


Apache MD5 algorithm ruby implementation taken from by Jeremy Hinegardner.