*Enter desired Username, Password, and Path (physical location where .htpasswd
will be stored). For example, Username amahi, Password amahi, and Path /var/hda/web-apps/linfo.
- Select the Generate .htaccess button.
- Copy the text in "This is what your .htaccess file should look like..." box and paste it into the
.htacess
file in the web application html directory (i.e. /var/hda/web-apps/linfo/html).
- Next copy the text from "And this is what your .htpasswd file should look like..." box and paste it into the
.htpasswd
file in then web application directory (i.e. /var/hda/web-apps/linfo).
- Proceed to the Set the Permissions section to complete.
- Perform the following steps as root user:
bash code
|
htpasswd -c -b .htpasswd username password
|
The .htpasswd
file should look similar to this:
Text
|
username:3Ce3F4zRcVf42
|
- To add additional users, repeat the previous step ((NOTE: the -c option is only needed the first time you create the file for that web application):
bash code
|
htpasswd -b .htpasswd username password
|
- Copy the
.htpasswd
file to the web application path (i.e. /var/hda/web-apps/appname).
Set the file permissions:
bash code
|
cp htpasswd /var/hda/web-apps/appname/htpasswd chmod 600 /var/hda/web-apps/appname/htpasswd chown apache:apache /var/hda/web-apps/appname/htpasswd
|