> I am trying to add 1200 users and initial passwords using htpasswd. I have
> the shell script to set up the users but the htpasswd command prompts for
> password and a confirmation. ie
> htpasswd "directory" "username"
> enter password:
> I want to feed the password prompt automatically. I thought that the
> following would work
> htpasswd "directory" "username" <"input file"
> Where input file contained 2 lines with the password. It does not work.
> Any help will be appreciated.
If you are referring to the htpasswd that is distributed
with Apache (and I must assume that, even though you
could take any old pile o' code and call it whatever you
want), it reads its password from /dev/tty, not stdin.
This is to prevent scripts like yours. You can hack the
code (I think it's in util.c), but it's been so long
since I had to do it that I'm reluctant to spend the
time in archeology. If you aren't one, find a
reasonably competent unix/C guy and he'll get it done in
an hour or so.