Linux Commands Examples

A great documentation place for Linux commands


manage user files for digest authentication


htdigest [ -c ] passwdfile realm username

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!


cat << EOF > .htaccess
AuthType Digest
AuthName "Password is required."
AuthUserFile `pwd`/.htdigest
Require user ${userName}
Require user ${userName}
htdigest -c .htdigest "Password is required." ${userName}



Create the passwdfile. If passwdfile already exists, it is deleted first.


Name of the file to contain the username, realm and password. If -c is given, this file is created if it does not already exist, or deleted and recreated if it does exist.


The realm name to which the user name belongs.


The user name to create or update in passwdfile. If username does not exist is this file, an entry is added. If it does exist, the password is changed.

security considerations

This program is not safe as a setuid executable. Do not make it setuid.


htdigest is used to create and update the flat-files used to store usernames, realm and password for digest authentication of HTTP users. Resources available from the Apache HTTP server can be restricted to just the users listed in the files created by htdigest.

This manual page only lists the command line arguments. For details of the directives necessary to configure digest authentication in httpd see the Apache manual, which is part of the Apache distribution or can be found at

How can this site be more helpful to YOU ?

give  feedback