Difference between revisions of "Require Login"
From Amahi Wiki
Line 7: | Line 7: | ||
#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>. | #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. | #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: | *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]. | #Navigate to [http://www.webmaster-toolkit.com/htaccess-generator.shtml .htaccess Generator]. | ||
Line 14: | Line 14: | ||
##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). | ##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>.htpassword</code> file in then web application directory (i.e. /var/hda/web-apps/linfo). | ##Next copy the text from ''"And this is what your .htpasswd file should look like..."'' box and paste it into the <code>.htpassword</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]]: | #Perform the following steps [[Open_Terminal_as_root|as root user]]: | ||
{{Code|htpasswd -c -b htpasswd username password}} | {{Code|htpasswd -c -b htpasswd username password}} |
Revision as of 23:15, 10 August 2011
Update Needed | |
---|---|
The contents of this page have become outdated or irrelevant. Please consider updating it. |
Do you want to control which HDA users can access web applications. While this function does not currently exist in Amahi, it can be done quite easily by following the steps outlined below. When a user accesses the specific web application, they will be asked for a user name and password.
How to do it
- This requires creation of two files (
.htaccess
andhtpassword
) be placed in the directory of each web application you want to protect. - The
htpasswd
file will identify user names/passwords (encrypted) and the.htaccess
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 (
/var/hda/web-app/appname
) on your server. For example, the path for Linfo would be /var/hda/web-app/linfo. - 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
htpasswd
and.htaccess
files:
- Navigate to .htaccess Generator.
- Enter desired Username, Password, and Path (physical location where
htpassword
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
.htpassword
file in then web application directory (i.e. /var/hda/web-apps/linfo). - Proceed to the Set the Permissions section to complete.
- Enter desired Username, Password, and Path (physical location where
- Perform the following steps as root user:
bash code |
---|
htpasswd -c -b htpasswd username password
|
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
|
The htpassword
file should look similar to this:
Text |
---|
username:3Ce3F4zRcVf42
|
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
|