Help with Password Protection of Web Server Virtual Hosts on QNAP 4.3.6

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
Post Reply
alan799
First post
Posts: 1
Joined: Wed Feb 20, 2019 1:05 am

Help with Password Protection of Web Server Virtual Hosts on QNAP 4.3.6

Post by alan799 » Fri Mar 08, 2019 2:52 am

Hi,
I am trying to password protect 2 virtual hosts "/share/Web/Site1” and "/share/Web/Site2”. I have searched the forums on this subject and learned a lot, but still need some help.

I want to use the Directive method (not sure this is the correct name) and put the userid and passwords in a database file because it is more secure then the .htaccess method.

The following are the 2 Directives that I would like to use. One for each virtual host with a different userid and password database:
<Directory "/share/Web/Site1">
AuthName "Log into Web Site"
AuthType Basic
AuthBasicProvider dbm
AuthDBMUserFile "/share/passwords/passwords1.dbm"
Require valid-user
</Directory>

<Directory "/share/Web/Site2">
AuthName "Log into Web Site"
AuthType Basic
AuthBasicProvider dbm
AuthDBMUserFile "/share/passwords/passwords2.dbm"
Require valid-user
</Directory>

The following are the description for each field, if I got them correct:
Directory
Specifies the directory that the following configuration applies to
AuthName "Log into Web Site"
The text that will display when logging in
AuthType Basic
Allows the use of HTTP Basic Authentication to restrict access by looking up users in the given providers.
AuthBasicProvider dbm
Authenticate users by looking up users in dbm password files
AuthDBMUserFile "/share/passwords/passwords1.dbm"
Sets the name of a DBM file containing the list of users and passwords. Do not put the DBM file in the directory that it protects. A perl script dbmmanage or a program htdbm can be used to create and update DBM format password files.
Require valid-user
Valid user is required

I think these directives should go in the apache.conf file. I found 3 of these files and not sure which one to use:
/hd_root_tmp/.config/apache/apache.conf
/usr/local/apache/conf/apache.conf
/etc/default_config/apache.conf

To create the userid and password database file in found the commands htdbm and dbmmanage in directory "/usr/local/apache/bin" but can’t get it to work using a console in WinSCP.

I am new at this and not sure I have this correct.

Regards
Alan

Post Reply

Return to “Web Server & Applications (Apache + PHP + MySQL / SQLite)”