htpasswd -c /etc/apache2/.htpasswd alice

Category: Web Servers & Proxies

htpasswd -c /etc/apache2/.htpasswd alice

Create an Apache basic auth password file

-c creates a new .htpasswd file and adds user alice, prompting for her password. Point AuthUserFile at this file to protect a directory with basic authentication. Warning: -c overwrites an existing file, so use it only for the first user.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.