Changes

From Amahi Wiki
Jump to: navigation, search
1,452 bytes added ,  02:23, 8 August 2019
{{NeedsUpdateMessageBox|backgroundcolor = #faa|image =Warning.png|heading =WARNING|message = This is recommended only for advanced users, proceed with caution.}}Do <div style="border: 1px solid #A3B1BF; padding: .8em 1em; background-color: #E6F2FF; margin: 0px 1em;">'''NOTE:''' The one-click [https://www.amahi.org/apps/web-apps Web Apps] will provide this capability in Amahi 7 or greater.</div>  Would you want like to control which HDA users can access certain web applications? This can be easily done in Amahi 6. While To use this function does not currently exist , select the web apps section in Amahithe apps tab. Expand the desired app and select the '''Require login''' check box. If selected, this settings makes it can be done quite easily by following such that the application will ask for a user name and a password. The perform the steps outlined belowto create the <code>htpasswd</code> file.   '''NOTE:''' When This is a user accesses global setting at the specific web applicationmoment, they will be asked for a user name i.e. the users and passwordare all the same to all the apps that have '''Require login''' selected. This feature <u>IS NOT</u> compatible with [[Secure_App_Access|Access Web Apps over SSL]].
== How to do it ==
*This requires creation of two files (the <code>.htaccesshtpasswd</code> and <code>htpassword</code>) be placed in the '''''/var/hda/web-apps''''' directory of each web application you want to protect.* The <code>htpasswd</code> file will identify user names/and passwords (encrypted) and .  ==== Create the htpasswd File ====There are two options for creating the <code>.htaccesshtpasswd</code> file :*Option 1: will contain the code needed Navigate to use that file to protect the web application[http://www.htaccesstools.com/htpasswd-generator/ htpasswd Generator].#First you need to identify the web application you want to protect <blockquote>*Enter desired Username, Password, and it's Path (physical location (where <code>.htpasswd</code>will be stored). For example, Username '''''amahi''''', Password '''''amahi''''', and Path '''''/var/hda/web-appapps'''''.*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 <code>.htpasswd</appnamecode> file. It should look similar to this: <pre>amahi:amb24e1pXrqFY</pre>*Proceed to the '''Copy and Set File Permissions''' section to complete.</blockquote>*Option 2: [[Open_Terminal_as_root|Open Terminal as root user]]<blockquote>*Create the <code>htpasswd</code> file (change username and password) on your server:<pre>htpasswd -c -b . For example, htpasswd username password</pre>*Proceed to the path for '''LinfoCopy and Set File Permissions''' would be section to complete.<u/blockquote==== 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): htpasswd -b /var/hda/web-apps/htpasswd username password*Delete a user, do the following: htpasswd -D /var/hda/web-apps/htpasswd username ==== Copy and Set File permissions: ====*Copy the <code>.htpasswd</code> file to the web application directory: cp .htpasswd /var/hda/web-apps/htpasswd* Ensure the permissions are correctly set on the two files as follows: chmod 600 /var/hda/web-appapps/linfohtpasswd 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 <code>html</ucode>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.#Next, *Now you need to decide setup users to allow login by clicking on the user names/passwords who will ''“Add a new user”'' in ''“Associated users and groups”'', when users have access. This has to been created you should be the HDA users credentials that are used good to log into the HDA Dashboardgo.
*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</code> will be stored).
##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 appllication html directory.
##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.
#Perform the following steps [[Open_Terminal_as_root|as root user]]:
{{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):
{{Code|htpasswd -b htpasswd username password}}
The <code>htpassword</code> file should look similar to this:
{{Text|username:3Ce3F4zRcVf42}}
* Set the file permissions'''NOTE:{{Code|cp htpasswd /var/hda/web''' After you have completed this process using Webmin you can then select ''"un-apps/appname/htpasswdchmod 600 /var/hda/webprotect selected directory"'' and use the HDA-apps/appname/htpasswdchown apache:apache /var/hda/web-apps/appnameDashboard to enable/htpasswd}}disable password protection.
12,424

edits