22.16.79. salt.modules.htpasswd

Support for htpasswd command

New in version 2014.1.0.

The functions here will load inside the webutil module. This allows other functions that don't use htpasswd to use the webutil module name.

salt.modules.htpasswd.useradd(pwfile, user, password, opts='')

Add an HTTP user using the htpasswd command. If the htpasswd file does not exist, it will be created. Valid options that can be passed are:

n Don't update file; display results on stdout. m Force MD5 encryption of the password (default). d Force CRYPT encryption of the password. p Do not encrypt the password (plaintext). s Force SHA encryption of the password.

CLI Examples:

salt '*' webutil.useradd /etc/httpd/htpasswd larry badpassword
salt '*' webutil.useradd /etc/httpd/htpasswd larry badpass opts=ns
salt.modules.htpasswd.useradd_all(pwfile, user, password, opts='')

Add an HTTP user using the htpasswd command. If the htpasswd file does not exist, it will be created. Valid options that can be passed are:

n Don't update file; display results on stdout. m Force MD5 encryption of the password (default). d Force CRYPT encryption of the password. p Do not encrypt the password (plaintext). s Force SHA encryption of the password.

CLI Examples:

salt '*' webutil.useradd /etc/httpd/htpasswd larry badpassword
salt '*' webutil.useradd /etc/httpd/htpasswd larry badpass opts=ns
salt.modules.htpasswd.userdel(pwfile, user)

Delete an HTTP user from the specified htpasswd file.

CLI Examples:

salt '*' webutil.userdel /etc/httpd/htpasswd larry

Docs for previous releases are available on salt.rtfd.org.

Latest Salt release: 2014.7.2

Previous topic

22.16.78. salt.modules.hosts

Next topic

22.16.80. salt.modules.img

SaltStack News

Upcoming SaltStack events, webinars and local meet ups and user groups.