Skip to main content

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

# To create/overwrite htpasswd file:
htpasswd -c <path/to/file> <user_name>

# To add user to htpasswd file or update existing user:
htpasswd <path/to/file> <user_name>

# To add user to htpasswd file in batch mode without an interactive password prompt (for script usage):
htpasswd -b <path/to/file> <user_name> <password>

# To delete user from htpasswd file:
htpasswd -D <path/to/file> <user_name>

# To verify user password:
htpasswd -v <path/to/file> <user_name>

# To display a string with username (plain text) and password (md5):
htpasswd -nbm <user_name> <password>