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>.

Install

All systems
curl cmd.cat/htpasswd.sh
Debian Debian
apt-get install apache2-utils
Ubuntu
apt-get install apache2-utils
Alpine
apk add apache2-utils
Arch Arch Linux
pacman -S apache
image/svg+xml Kali Linux
apt-get install apache2-utils
CentOS
yum install httpd-tools
Fedora
dnf install httpd-tools
Windows (WSL2)
sudo apt-get update sudo apt-get install apache2-utils
Raspbian
apt-get install apache2-utils
Docker
docker run cmd.cat/htpasswd htpasswd powered by Commando

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

© tl;dr; authors and contributors