htpasswd entry will appear here
Enter username and password to generate.htpasswd admin
Every coffee helps keep the servers running. Every book sale funds the next tool I'm dreaming up. You're not just supporting a site — you're helping me build what developers actually need.
The htpasswd utility creates and updates flat-files storing usernames and passwords for basic HTTP authentication in Apache and Nginx web servers.
htpasswd uses the Modular Crypt Format (MCF) which identifies the algorithm by a prefix:
| Prefix | Algorithm | Security | Notes |
|---|---|---|---|
$2y$ / $2a$ |
bcrypt | Excellent | Recommended. Adjustable cost factor. |
$6$ |
SHA-512 | Very Good | 5000 rounds default. Good alternative. |
$5$ |
SHA-256 | Good | 5000 rounds default. |
$apr1$ |
APR-MD5 | Fair | Apache-specific MD5. Legacy support. |
{SHA} |
SHA-1 | Weak | Unsalted. Not recommended. |
| (none) | crypt(3) | Weak | DES-based. 8 char max. Avoid. |
location /protected {
auth_basic "Restricted Area";
auth_basic_user_file /etc/nginx/.htpasswd;
}
<Directory "/var/www/protected">
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
htpasswd hashes are designed to be stored in authentication files. The recipient can use this URL to verify if they know the correct password.