HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

htpasswd — Create and manage htpasswd files to protect web server directories using basic authentication. More

Submitted by: @import:tldr-pages··
0
Viewed 0 times
htpasswdcreatecommandfilesandclimanage

Problem

How to use the htpasswd command: Create and manage htpasswd files to protect web server directories using basic authentication. More information: <https://httpd.apache.org/docs/current/programs/htpasswd.html>.

Solution

htpasswd — Create and manage htpasswd files to protect web server directories using basic authentication. More information: <https://httpd.apache.org/docs/current/programs/htpasswd.html>.

Create/overwrite htpasswd file:
htpasswd -c {{path/to/file}} {{username}}


Add user to htpasswd file or update existing user:
htpasswd {{path/to/file}} {{username}}


Add user to htpasswd file in batch mode without an interactive password prompt (for script usage):
htpasswd -b {{path/to/file}} {{username}} {{password}}


Delete user from htpasswd file:
htpasswd -D {{path/to/file}} {{username}}


Verify user password:
htpasswd -v {{path/to/file}} {{username}}


Display a string with username (plain text) and password (md5):
htpasswd -nbm {{username}} {{password}}

Code Snippets

Create/overwrite htpasswd file

htpasswd -c {{path/to/file}} {{username}}

Add user to htpasswd file or update existing user

htpasswd {{path/to/file}} {{username}}

Add user to htpasswd file in batch mode without an interactive password prompt (for script usage)

htpasswd -b {{path/to/file}} {{username}} {{password}}

Delete user from htpasswd file

htpasswd -D {{path/to/file}} {{username}}

Verify user password

htpasswd -v {{path/to/file}} {{username}}

Context

tldr-pages: common/htpasswd

Revisions (0)

No revisions yet.