HTDBM(1)
π HTDBM β the htdbm manual, but make it make sense π
okay bestie, welcome to htdbm β the lil tool that pokes at DBM password databases. This is the htdbm(1) page from the htdbm manual. Sit down, grab a strawberry π, we're doing this.
β¨ NAME β¨
htdbm β Manipulate DBM password databases. that's it, that's the job π
β¨ SYNOPSIS β¨
htdbm [ -TDBTYPE ] [ -i ] [ -c ] [ -m | -B | -d | -s | -p ] [ -C cost ]
[ -t ] [ -v ] filename username
htdbm -b [ -TDBTYPE ] [ -c ] [ -m | -B | -d | -s | -p ] [ -C cost ] [ -t
] [ -v ] filename username password
htdbm -n [ -i ] [ -c ] [ -m | -B | -d | -s | -p ] [ -C cost ] [ -t ] [
-v ] username
htdbm -nb [ -c ] [ -m | -B | -d | -s | -p ] [ -C cost ] [ -t ] [ -v ]
username password
htdbm -v [ -TDBTYPE ] [ -i ] [ -c ] [ -m | -B | -d | -s | -p ] [ -C cost
] [ -t ] [ -v ] filename username
htdbm -vb [ -TDBTYPE ] [ -c ] [ -m | -B | -d | -s | -p ] [ -C cost ] [
-t ] [ -v ] filename username password
htdbm -x [ -TDBTYPE ] filename username
htdbm -l [ -TDBTYPE ]
yes there are eight forms, no we are not skipping any, keep scrolling π«Ά
β¨ SUMMARY β¨
htdbm is your girl for manipulating the DBM format files that store usernames and passwords for basic auth of HTTP users, via mod_authn_dbm. Wanna know more about these DBM files in general? Go read the dbmmanage documentation, it's right there, go look π
β¨ OPTIONS β¨
-bβ batch mode, bestie! grabs the password straight off the command line instead of prompting you for it. Use this with extreme care, because the password is literally just sitting there visible on the command line, no cap π. For scripts, use the-ioption instead.-iβ read the password from stdin without verification (for script usage).-cβ create the passwdfile. If passwdfile already exists, it gets rewritten and truncated β poof, gone. This option cannot be combined with the-noption.-nβ display the results on standard output instead of updating a database. Heads up, this changes the syntax of the command line, since the passwdfile argument (usually the first one) gets omitted. Cannot be combined with the-coption.-mβ use MD5 hashing for passwords. On Windows and Netware, this is the default.-Bβ use bcrypt hashing for passwords. This is currently considered to be very secure π₯-Cβ only allowed in combination with-B(bcrypt hashing). It sets the computing time used for the bcrypt algorithm. Higher is more secure but slower. Default:5, valid:4to31.-dβ usecrypt()hashing for passwords. The default on all platforms but Windows and Netware. Though possibly supported byhtdbmon all platforms, it is not supported by the httpd server on Windows and Netware. This algorithm is insecure by today's standards.-sβ use SHA hashing for passwords. Facilitates migration from/to Netscape servers using the LDAP Directory Interchange Format (ldif). This algorithm is insecure by today's standards.-pβ use plaintext passwords. Even thoughhtdbmwill support creation on all platforms, the httpd daemon will only accept plain text passwords on Windows and Netware. π¬-lβ print each of the usernames and comments from the database on stdout.-vβ verify the username and password. The program prints a message telling you whether the supplied password is valid. If the password is invalid, it exits with error code3.-xβ delete user. If the username exists in the specified DBM file, it gets deleted. bye felicia π-tβ interpret the final parameter as a comment. When you use this, an additional string can be appended to the command line, and that string gets stored in the"Comment"field of the database, associated with the specified username.filenameβ the filename of the DBM format file. Usually without the extension.db,.pag, or.dir. If-cis given, the DBM file is created if it does not already exist, or updated if it does exist.usernameβ the username to create or update in passwdfile. If username does not exist in this file, an entry is added. If it does exist, the password is changed.passwordβ the plaintext password to be hashed and stored in the DBM file. Used only with the-bflag.-TDBTYPEβ type of DBM file (SDBM,GDBM,DB, or"default").
β¨ BUGS β¨
okay this part is lowkey important, pay attention π§
You should be aware that there are a number of different DBM file formats in existence, and with all likelihood, libraries for more than one format may exist on your system. The three primary examples are SDBM, NDBM, GNU GDBM, and Berkeley/Sleepycat DB 2/3/4. (yes bestie, "three primary examples" and then four things listed, I know, I know, I'm just the messenger π) Unfortunately, all these libraries use different file formats, and you must make sure that the file format used by filename is the same format that htdbm expects to see. htdbm currently has no way of determining what type of DBM file it is looking at. If used against the wrong format, will simply return nothing, or may create a different DBM file with a different name, or at worst, it may corrupt the DBM file if you were attempting to write to it. π
One can usually use the file program supplied with most Unix systems to see what format a DBM file is in. slay, problem solved β¨
β¨ EXIT STATUS β¨
htdbmreturns a zero status ("true") if the username and password have been successfully added or updated in the DBM File.1β it encounters some problem accessing files.2β there was a syntax problem with the command line.3β the password was entered interactively and the verification entry didn't match.4β its operation was interrupted.5β a value is too long (username, filename, password, or final computed record).6β the username contains illegal characters (see the Restrictions section).7β the file is not a valid DBM password file.
write these down, they're giving cheat sheet energy π
β¨ EXAMPLES β¨
htdbm /usr/local/etc/apache/.htdbm-users jsmith
Adds or modifies the password for user jsmith. The user is prompted for the password. If executed on a Windows system, the password will be hashed using the modified Apache MD5 algorithm; otherwise, the system's crypt() routine will be used. If the file does not exist, htdbm will do nothing except return an error. π«
htdbm -c /home/doe/public_html/.htdbm jane
Creates a new file and stores a record in it for user jane. The user is prompted for the password. If the file exists and cannot be read, or cannot be written, it is not altered and htdbm will display a message and return an error status.
htdbm -mb /usr/web/.htdbm-all jones Pwd4Steve
Encrypts the password from the command line (Pwd4Steve) using the MD5 algorithm, and stores it in the specified file. π
β¨ SECURITY CONSIDERATIONS β¨
bestie. this section is not a vibe, it's a warning. read it fr fr.
Web password files such as those managed by htdbm should not be within the Web server's URI space β that is, they should not be fetchable with a browser. do not let the internet just... look at your password file.
The use of the -b option is discouraged, since when it is used the plaintext password appears on the command line.
When using the crypt() algorithm, note that only the first 8 characters of the password are used to form the password. If the supplied password is longer, the extra characters will be silently discarded. π
The SHA hashing option does not use salting: for a given password, there is only one hashed representation. The crypt() and MD5 formats permute the representation by prepending a random salt string, to make dictionary attacks against the passwords more difficult.
The SHA and crypt() formats are insecure by today's standards.
β¨ RESTRICTIONS β¨
On the Windows platform, passwords hashed with htdbm are limited to no more than 255 characters in length. Longer passwords will be truncated to 255 characters.
The MD5 algorithm used by htdbm is specific to the Apache software; passwords hashed using it will not be usable with other Web servers.
Usernames are limited to 255 bytes and may not include the character :. (yes, that colon specifically. no colons. none. π«)
β¨ FILES β¨
The DBM password file path is specified as an argument on the command line and may be located anywhere on the filesystem. π
filenameβ the DBM format file containing usernames and passwords.
and that's the whole page, bestie, you ate that π β¨
This one came from the Apache HTTP Server source, dated 2026-05-08 β so if you're citing it, that's the version and the date to drop. mwah, go hash responsibly ππ¦
π¦ where this page comes from
- alpine 3.22: apache2-doc 2.4.69-r0 Β· Apache-2.0
- alpine 3.23: apache2-doc 2.4.69-r0 Β· Apache-2.0
- alpine 3.24: apache2-doc 2.4.69-r0 Β· Apache-2.0
- arch rolling: apache 2.4.69-1 Β· Apache-2.0
- debian bookworm: apache2-utils 2.4.68-1~deb12u1 Β· Apache-2.0
- debian trixie: apache2-utils 2.4.68-1~deb13u1 Β· Apache-2.0
- debian trixie: apache2-utils 2.4.69-1~deb13u1 Β· Apache-2.0
- fedora 43: httpd-tools 2.4.68-1.fc43
- fedora 43: httpd-tools 2.4.69-1.fc43 Β· Apache-2.0 AND (BSD-3-Clause AND metamail AND HPND-sell-variant AND Spencer-94)
- fedora 44: httpd-tools 2.4.69-1.fc44 Β· Apache-2.0 AND (BSD-3-Clause AND metamail AND HPND-sell-variant AND Spencer-94)
- nixpkgs unstable: apache-httpd 2.4.69
- ubuntu stonking: apache2-utils 2.4.68-1ubuntu4 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms