How can I use Servlets to add entries to the password list in Apache? I tried to invoke the htpasswd.exe but it doesn't work.

Dieter Wimberger

Your servlet needs write access to the AuthUserFile specified in the access file (Check the Apache Documentation on that).
Then you need some utility implmenting a standard C crypt() in Java. Those are freely available from different Java resource pages.
Now just open the file and append(!) a line that has the following format: [username]:[crypted password] Don't forget there are certain security issues regarding what you want to do. I would not recommend to do this within security sensible environments.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact