Login/Pass to one folder on website, howto?

Discussion on setting up QNAP NAS products.
Post Reply
lakulaku
Starting out
Posts: 12
Joined: Sun Apr 03, 2011 1:40 pm

Login/Pass to one folder on website, howto?

Post by lakulaku » Thu Apr 14, 2011 2:09 am

I would like to login/password protect one folder in my web server so that it was be accessed from internet with browser as long as you know the login/password.

http://www.website.com virtual server is configured on the NAS Web server and works ok.

I created the .htaccess with Windows notepad to [/share/Qweb/www.website.com/protected_folder]

AuthType Basic
AuthName "Private Area - Password Required"
AuthUserFile /share/Qweb/www.website.com/protected_folder/.htpasswd
Require valid-user
# allow directory indexing
Options +Indexes
# optional: adding fancy directory indexing
IndexOptions +FancyIndexing


Then I Telnet to Qnap and
[/share/Qweb/www.website.com/protected_folder] # /mnt/ext/opt/apache/bin/htpasswd -bc /share/Qweb/www.website.com/protected_folder/.htpasswd demo user

Now webserver does ask for login/pass, but fails to the "500 internal error" when I enter demo/user as login.

The entry at logfile: "Could not open password file: /var/www/passwd" might point out, that Qnap is searching the .htpasswd from wrong folder.

All folders are accessible from my Windows PC normally as they should.

How to fix this, pls help?

Zappcola
New here
Posts: 5
Joined: Sat Sep 24, 2011 10:50 am

Re: Login/Pass to one folder on website, howto?

Post by Zappcola » Sat Sep 24, 2011 11:05 am

I have a very similar problem however without website.com or similar, my IP is static so i'm just port fowarding.
Anyway when I add the following .htaccess

"AuthUserFile /web/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic
require user valid-user"

and .htpasswd

"someone:password" <-- not encrypted (does it have to be?)

I have no idea how to look at my apache logs so any help would be awesome

User avatar
schumaku
Guru
Posts: 43648
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Login/Pass to one folder on website, howto?

Post by schumaku » Sat Sep 24, 2011 4:19 pm

Zappcola wrote:and .htpasswd
"someone:password" <-- not encrypted (does it have to be?)


Please check the Apache htpasswd documentation on how to create and maintain the file:
http://httpd.apache.org/docs/2.2/programs/htpasswd.html

On the NAS, htpasswd binary is here: /mnt/ext/opt/apache/bin/htpasswd

Zappcola wrote:I have no idea how to look at my apache logs so any help would be awesome


The Apache log files (by default access_log, error_log, and sql_request_log) are located in /mnt/ext/opt/apache/logs/

Zappcola
New here
Posts: 5
Joined: Sat Sep 24, 2011 10:50 am

Re: Login/Pass to one folder on website, howto?

Post by Zappcola » Tue Sep 27, 2011 8:52 am

thanks schumaku

the only way I know how to access the "/mnt" folder and all other folders excluding default and user addd shares is by removing the drive then via USB access, i'm sure there is a better way?
I have tried WINSCP but still cant get anything other than the shares.

After looking around I found this handy little peice of code..
http://www.htaccesstools.com/articles/f ... using-php/
Solved my problem straight up..

also this little generator...
http://www.htaccesstools.com/htaccess-authentication/

Any ideas on my access problem would still help, thanks again

Post Reply

Return to “Turbo Station Installation & Setup”