Difference between revisions of "Require Login"

From Amahi Wiki
Jump to: navigation, search
Line 48: Line 48:
 
*In “Directory path” browse to/or enter the path to the ‘html’ web directory you wish to protect, in “Authentication realm” enter something like for example “Authentication required” (this will show up on the popup login box) and then click on create.
 
*In “Directory path” browse to/or enter the path to the ‘html’ web directory you wish to protect, in “Authentication realm” enter something like for example “Authentication required” (this will show up on the popup login box) and then click on create.
 
*Now you need to setup users to allow login by clicking on “Add a new user” in “Associated users and groups”, when users have been created you should be good to go.
 
*Now you need to setup users to allow login by clicking on “Add a new user” in “Associated users and groups”, when users have been created you should be good to go.
 +
  
 
'''NOTE:'''  After you have completed this process using webmin you can then select "un-protect selected directory" and use the HDA-Dashboard to enable/disable password protection.
 
'''NOTE:'''  After you have completed this process using webmin you can then select "un-protect selected directory" and use the HDA-Dashboard to enable/disable password protection.

Revision as of 03:23, 13 August 2011

Warning.png WARNING
This is recommended only for advanced users, proceed with caution.


Would you like to control which HDA users can access certain web applications? This can be easily done in Amahi 6.

To use this function, select the web apps section in the apps tab. Expand the desired app and select the Require Login check box. If selected, this settings makes it such that the application will ask for a user name and a password. The perform the steps below to create the htpasswd file.

NOTE: This is a global setting at the moment, i.e. the users and password are all the same to all the apps that have Require Login selected.

How to do it

  • This requires creation of the htpasswd) be placed in the /var/hda/web-apps directory.
  • The .htpasswd file will identify user names/passwords (encrypted).
  1. 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 htpasswd File

There are two options for creating the htpasswd file:

  • 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 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). It should look similar to this:
Text
​amahi:amb24e1pXrqFY​
  • Proceed to the Set the Permissions section to complete.
  • Option 2:
  • Perform the following steps as root user (change username and password):
bash code
​htpasswd -c -b .htpasswd username password​
  • Copy the .htpasswd file to the web application directory:
bash code
​cp .htpasswd /var/hda/web-apps/htpasswd​
  • Next, set the permissions.

User Maintenance (Add/Delete)

  • 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​
  • Delete a user, do the following:
bash code
​htpasswd -D .htpasswd username​


Set File permissions:

  • Ensure the permissions are correctly set on the two files as follows:
bash code
​chmod 600 /var/hda/web-apps/htpasswd chown apache:apache /var/hda/web-apps/htpasswd​


If you have Webmin installed

  • After logging into webmin select “Others” on the left-hand side, click on “Protected Web Directories” and then select “Add protection for a new directory”.
  • In “Directory path” browse to/or enter the path to the ‘html’ web directory you wish to protect, in “Authentication realm” enter something like for example “Authentication required” (this will show up on the popup login box) and then click on create.
  • Now you need to setup users to allow login by clicking on “Add a new user” in “Associated users and groups”, when users have been created you should be good to go.


NOTE: After you have completed this process using webmin you can then select "un-protect selected directory" and use the HDA-Dashboard to enable/disable password protection.