Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   Accessing 2 AuthUserFiles using htaccess? (http://www.greenguysboard.com/board/showthread.php?t=15137)

codemonkey 2005-01-10 09:48 AM

Accessing 2 AuthUserFiles using htaccess?
 
Been racking my brains and googling for a couple of hours but so far i can't figure out how to do this.

I've got 2 htpasswd files on one server and I want to authenticate users against them. They have to be in 2 different files because one site that we have allows access to all our sites, which comes from a central location. The other file is for each individual site.

When I use this htaccess

AuthUserFile /path/to/htpasswd1
AuthUserFile /path/to/htpasswd2

It only authenticates users that are in htpasswd2 and ignores the htpasswd1 file

Anybody have any experience doing this and if so would they be kind enough to share :D

Thanks!

swedguy 2005-01-10 10:37 AM

I ran into that problem a long time ago, and at that time it wasn't possible without any custom or 3rd party modules. I ended up making a quick cron that ran once a minute instead.

Put this in your crontab

* * * * * cat /path/to/htpasswd1 /path/to/htpasswd2 > /path/to/htpasswd3

Now htpasswd3 will contain both htpasswd1 and 2.


So now your htpasswd will contain this instead:

AuthUserFile /path/to/htpasswd3

codemonkey 2005-01-10 11:42 AM

Swedguy

Thanks very much that should do the job i already have a cron job running that sends the htpasswd file to the other server so this other cron job will complete the masterpiece.

Thanks again!

swedguy 2005-01-10 12:07 PM

np :)


All times are GMT -4. The time now is 04:52 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc