.htaccess
AuthName "Restricted Area"
AuthType Basic
AuthUserFile path/.htpasswd
require valid-user
.htpasswd
test:FUgb1Qdh6571o
#This tool is used to generate password file http://tools.dynamicdrive.com/password/
When Apache is running on Windows 10 and I'm trying to access folder authentication dialog appears, however it does not authenticate and does not allow to access restricted folder.
Apache error logs:
AH01617: user test: authentication failure for "/folder": Password Mismatch
Same setup works correctly when Apache is working on Ubuntu
What could be wrong? Different method of password storing?
CodePudding user response:
I don't know about online tool you used, but I recommend to use
htpasswd
tool generate passwords.
Appear that test:FUgb1Qdh6571o
is generated with algorithm that are not recommended. More info about htpassword could be found at htpasswd docs
To create a new db
use:
htpasswd -c .htpasswd test
To update password use:
htpasswd .htpasswd test
PS. I don't recommend to use online passwords generator. Could be harvested and later used against you.
PS.2 Probably htpasswd
command is in apache installation directory
CodePudding user response:
It could be fault of the line ending encoding, which is LF
on Linux and CR LF
on Windows.
In a hex editor LF
would show up as 0a
whereas CR LF
would be 0d 0a
. On Ubuntu you can check with xxd .htpasswd
from the terminal and on Windows you can use Notepad to show special characters.