Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
does the directory admin belong to the user you are trying to auth as, or does it belong to the http user?
Why would that be an issue? I should be able to add any user/pwd combination. The .htpasswd user list is unrelated to user accounts on the particular server.
However...
I created user "MyDomain" in /home/MyDomain, I created /public_html/admin as user MyDomain. So the owner of admin is user MyDomain.
But as I said, I don't really think it matters to Apache with respect to basic authentication and .htaccess / .htpasswd.
Why would that be an issue? I should be able to add any user/pwd combination. The .htpasswd user list is unrelated to user accounts on the particular server.
However...
I created user "MyDomain" in /home/MyDomain, I created /public_html/admin as user MyDomain. So the owner of admin is user MyDomain.
But as I said, I don't really think it matters to Apache with respect to basic authentication and .htaccess / .htpasswd.
1. You have a problem getting Apache to access a specific directory. You post an inquiry.
2. Someone asks you whether you have assured that Apache has rights to that directory.
3. Your response is "Why would that be an issue?"
No wonder you're having problems. Tell me how you think Apache can access any directory it cares to, based only on its configuration, without regard to system-wide access permissions.
Above all else, the target directory must be accessible to Apache's default user and group. Trust me on this.
You can add any user/passwd combo, for people accessing this content from the net, but Apache needs to be able to see this directory and navigate in it. For example, I use scripts to backup my website to a tmp folder outside the webroot. The tmp folder has to be writable by www-data in order that apache can use it. Same goes for you. Here is a way you can do it:
Also, NEVER put the htpasswd file in a documents dir. Anyone on the web can grab a copy and try to break it. Store it with the httpd.conf
BTW, no need to make it 'hidden' ie leading '.' is redundant.
1. You have a problem getting Apache to access a specific directory. You post an inquiry.
2. Someone asks you whether you have assured that Apache has rights to that directory.
3. Your response is "Why would that be an issue?"
No wonder you're having problems. Tell me how you think Apache can access any directory it cares to, based only on its configuration, without regard to system-wide access permissions.
Above all else, the target directory must be accessible to Apache's default user and group. Trust me on this.
It is *unnecessary* to become nasty and rude. "Why would that be an issue?" is a perfectly valid question, which you go on to answer. Could you have answered without being so rude?
Thanks John VV, irishbitte, and chrism01 for providing helpful responses! Much appreciated, you have helped me solve the issue.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.