[SOLVED] What's the safest place for a .htpasswd file?
Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm running an apache webserver for my rtorrent webui, password protected via .htaccess, but i don't really know what's the safest place for .htpasswd.
It's in my home directory atm.
Where should i put it?
Much more important than where you put is is the protections you assign to it. The best way I can think of is to make sure that you have a group defined that has only the web server in it, and then assign the file a protection mode (chmod) of 0640. This allows the owner (presumably you) to read and write the .htpasswd file, and allows the web server to read it, and no one else to do anything to it.
In general, just make sure that the file is not in any place that is reachable by a URL ... and be sure that Apache does not accept ".." relative directory addresses in any of those URLs.
Generally, .htpasswd would be outside the Document area, typically in the same dir as httpd.conf or similar.
.htaccess (a different thing entirely) is best not used and instead put the directives inside the relevant Direcorty tags inside httpd.conf
Quote:
However, in general, use of .htaccess files should be avoided when possible. Any configuration that you would consider putting in a .htaccess file, can just as effectively be made in a <Directory> section in your main server configuration file.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.