The htpasswd application is used to create and maintain
text-based authentication databases for use with the mod_auth
module. It gets the username and options from the command line, prompts
for and reads the password from standard input (twice, for verification),
and stores the username and the encrypted password in the
specified text file. When the Apache server receives credentials to
verify, it encrypts the submitted password using the same algorithm
as the stored password, and then compares the results — so the
actual plaintext password doesn’t live in a file on your system.
The syntax of the htpasswd command is:
htpasswd [options] pwfile username [password]
htpasswd can encrypt the passwords using a variety of
algorithms, indicated by the algorithm flag on the command line:
-m.htpasswd file from Linux to AIX to Solaris to-dcrypt() library routine to-s-p-p flag means ‘plaintext — don’t encrypt the The encryption algorithm used is particular to each entry in the
file, so it’s entirely possible for a file to contain passwords
encrypted in different ways.
The htpasswd tool understands two other flags,
which control other aspects than encryption:
-bstdin. This flag is primarily intended to help Windowsps command, and there’s no verification that it-chtpasswd assumes that thepwfile authentication database file already-c flag to theProperty of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved
Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.