Changes

From Amahi Wiki
Jump to: navigation, search
100 bytes added ,  23:19, 10 August 2011
== How to do it ==
*This requires creation of two files (<code>.htaccess</code> and <code>htpassword.htpasswd</code>) be placed in the directory of each web application you want to protect.*The <code>.htpasswd</code> file will identify user names/passwords (encrypted) and the <code>.htaccess</code> file will contain the code needed to use that file to protect the web application.
#First you need to identify the web application you want to protect and it's physical location (<code>/var/hda/web-app/appname</code>) on your server. For example, the path for '''Linfo''' would be <u>'''/var/hda/web-app/linfo'''</u>.
#Next, you need to decide on the user names/passwords who will have access. This has to be the HDA users credentials that are used to log into the HDA Dashboard.
==== Create the Files ====
*There are two options for creating the <code>.htpasswd</code> and <code>.htaccess</code> files:
#Navigate to [http://www.webmaster-toolkit.com/htaccess-generator.shtml .htaccess Generator].
##Enter desired Username, Password, and Path (physical location where <code>htpassword.htpasswd</code> 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 <code>.htacess</code> 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 <code>.htpasswordhtpasswd</code> 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 [[Open_Terminal_as_root|as root user]]:
{{Code|htpasswd -c -b .htpasswd username password}}The <code>.htpasswd</code> 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):
{{Code|htpasswd -b .htpasswd username password}}*Copy the <code>.htpasswd</code> file to the web application path (i.e. /var/hda/web-apps/appname).
==== Set the file permissions: ====
{{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}}
12,424

edits