I'm writing a DockerFile to build an image with apache2 and u2fval, and I need to create credentials for one user using apache2 digest. But the command:
htdigest -c /whatever/myfile.digest "realm" user
will always ask user for password, is there a way for me to give the command a password to use (Without prompting user etc...) ? Thanks.
Don't add this command in Dockerfile
directly. if you add password to Dockerfile
then anyone can read.
just run this command to somewhere and create password file:
htdigest -c myfile.digest "realm" user
Now add this file to Dockerfile
wherever you want to add using:
ADD myfile.digest /whatever/myfile.digest
OR
i would recommend you to not add this password file while image building. add while deploying that will be better when you want to change password.
OR
Still your requirement is this then refer these answer:
How do you htdigest 400 user accounts?
Scripting htdigest -c /path/to/file/$user $user $password in Bash