howto run the htpasswd command with input from file for 500 usernames !!
One of our customers required a password protected area on their webspace. We successfully completed this by creating a .htaccess and .htpasswd file in the protected folder.
Then they decided that they would need up to 500 usernames and passwords - gasp. Inputing these with the command "htpassword -mb /var/www/secure/.htpasswd" is going to be very tedious. And whenever they add a or delete a user the changes will have to be made manually. I was hoping that there may be a way to run the htpasswd command by gathering the usernames and passwords from a txt file or similar, but all of my "newbie" attempts have not worked. One encouraging thing though is that if I add a user twice then their details are just updated and not duplicated which would mean if there is a way to do this then the list could just be edited and re-entered. Thanks All in advance. PK |
why not use a database as backend by using this module of apache:
mod_authn_dbm.so http://httpd.apache.org/docs/2.0/mod/mod_auth_dbm.html |
You can use a bash script like this:
Code:
#!/bin/sh |
Newbie
Registered: Mar 2005
Posts: 10
Distribution:
Thanks Thermite_1033
Unfortunatly the web sever is not mine and I am limited to the modifications or additions I can make to apache. But I am experimenting with your suggestion on my Debian box and will test it out |
Hi Bathory
That was the script I was after, it worked GREAT, I modded the path to the htpasswd command to suit debian and a test import went through without a hitch I can easily export the users and passwords file with a ":" delimiter so this will simplify the task a lot. I've goto learn more about bash scripting, so I'll pick apart your one as a trainer. I wonder if with some adjustments this could be used for other commands. Thanks again, saved me hours |
All times are GMT -5. The time now is 06:39 PM. |