Home > Tools

HTPasswd Generator

Create password credentials for htaccess and htpasswd files.

Enter username:

Enter password:

algorithm :

Output

copy the entry bellow into your .htpasswd file

The Apache HTTP Server can use a .htpasswd file referenced from a .htaccess file to create restricted protected areas. The .htpasswd file contains rows corresponding to a pair of username and password separated with a colon character. The password is encrypted using the UNIX system's crypt method and may use MD5 or SHA1.

This .htpasswd generator creates passwords that are hashed using the MD5 algorithm. Those passwords can be used on any platform including Windows, MacOsX and Linux.

Once set up, a user wishing to access a restricted directory will be requested a username and password pair to gain access. Only correct pairs will grant access to the requested directory.

Protecting a folder in Apache

To protect a specific folder, a .htaccess file is placed in the directory you want the contents of the file to affect. The rules and configuration directives in the .htaccess file will be enforced on whatever directory it is in and all sub-directories as well. A typical .htaccess file looks like the following:

AuthUserFile /path/to/.htpasswd
AuthType Basic
AuthName "My restricted Area"
Require valid-user

The corresponding .htpasswd file must be placed in the folder defined by the AuthUserFile directive. In that case, it will be located in the "/path/to/.htpasswd" directory. A typical .htpasswd file looks like the following:

user1:$apr1$clme56rh$7kbO8h94VA5UWBNpdayu80
user2:$apr1$l76zf4jy$M7064lZwDjJjGigJ48fqP/
user3:$apr1$f2dmapgz$C.8mBkD1DoUiBVJGaCfJM0