create new tag
, view all tags
ALERT! NOTE: This is a SupplementalDocument topic which is not included with the official TWiki distribution. Please help maintain high quality documentation by fixing any errors or incomplete content. Put questions and suggestions concerning the documentation of this topic in the comments section below! Use the Support web for problems you are having using TWiki.


How can I create a .htpasswd file that is owned by the webserver user?

A common problem is that installers who don't have root access can't write files owned by the webserver user. As a result, they have to create a .htpasswd file themselves, and are then forced to give it "world" rights (0777) so the webserver user can read/write it. This FAQ explains how to create a .htpasswd file that is owned by the webserver user.


In the TWiki 'bin' directory, create a perl script called mkpasswd as follows:

require 'setlib.cfg';
print "Content-type: text/html\n\n";
open(F, ">", $TWiki::cfg{Htpasswd}{FileName}) || die "$TWiki::cfg{Htpasswd}{FileName}: $!";
# Next three lines are optional; you can paste in the contents of your existing .htpasswd in place of =guest::= if you want
print F <<'EOF';
print "Created .htpasswd\n";
Correct the permissions, shebang line and script extension as appropriate. Then run the script from the browser (open configure, and replace the configure in the URL with mkpasswd).

VERY IMPORTANT Delete the script as soon as you are finished. Otherwise someone else might accidentally activate it and overwrite your .htpasswd.

Back to: TWikiFAQ

-- Contributors: CrawfordCurrie

Comments & Questions about this Supplemental Document Topic

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2006-03-12 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.