I am trying to use ansible to create .haccess and .htpasswd files
htpasswd: path=/mypath/.htpasswd name=test password=test owner=root group=root mode=0640
But I can't login with the test:test credentials
The value inside the file does seem valid and has correctly used the APR MD5 algorithm
test:$apr1$i7i0IUWn$YwAufYj/eBdNPxFdZ7sYX0
I'm using ansible 1.7.2, the host machine is Centos 6.5
htpasswd: path=/mypath/.htpasswd name=test password=test owner=root group=root mode=0640
This creates a htpasswd file that is read/writeable by root
, readable by users in the root
group (which is only root
), and not readable by the world.
Assuming you are running apache as user apache
and there's an apache
group, this is what you want:
htpasswd: path=/mypath/.htpasswd name=test password=test owner=apache group=apache mode=0640
You could actually lock it down to be a little bit safer, since apache
only needs to read the file, not write it:
htpasswd: path=/mypath/.htpasswd name=test password=test owner=root group=apache mode=0640