Any Apache brains out there?

engineereeyore

Platinum Member
Jul 23, 2005
2,070
0
0
So here's the deal. I'm rather new to apache, but trying to learn. So I set it up on my Linux server and got everything working, as far as just my basic site. I've got additional folders that I'd like to be able to access, but I want to restrict who can access them. So I read up on DBM and am trying to implement it. That way I can just require a log in and all that and be good to go.

So I've included 'LoadModule authn_dbm_module modules/mod_authn_dbm.so' in the module section. Version 2.2 seems to load pretty much all of the common modules automatically. I then put in:

<Directory "/mnt/Drive/Website/Games">
AuthName "Restricted Stuff"
AuthType Basic
AuthDBMUserFile /usr/local/apache2/passwd/users
Require valid-user
Order allow,deny
Allow from all
</Directory>

I've got that directory aliased as the /Games directory on my website. I then used dbmmanage to create the file users.dat (not sure why .dat, but that's what was in the example on the apache website). Anyway, I then restarted apache, restarts just fine. I go to the website and the GUI pops up asking for username and password. I enter it, and then it dies.

I then get the error below in my error log:
"[Tue Feb 13 09:03:40 2007] [error] Internal error: pcfg_openfile() called with NULL filename
[Tue Feb 13 09:03:40 2007] [error] [client 192.168.15.100] (9)Bad file descriptor: Could not open password file: (null)"

Anyone got any ideas what I need to do to fix this? I know I could just restrict access via IP address, but I'd rather do it with username/password. Any help or ideas would be appreciated.
 

Cheetah8799

Diamond Member
Apr 12, 2001
4,508
0
76
I don't know all the details on what you are trying to do, but it sounds like you are maybe making it harder than it needs to be. You could set it up using Apache's Basic Authentication. It's not fancy, but it gets the job done if you don't have a lot of accounts to manage.

Alternatively you could even set it up to connect to a mysql database, ldap or something else for authentication if you need a more manageable or secure solution.

http://httpd.apache.org/docs/2.2/howto/auth.html

http://httpd.apache.org/docs/2.2/mod/mod_auth_basic.html

http://httpd.apache.org/docs/2.2/programs/htpasswd.html



edit: it looks like you are kinda mixing two things up here. Your config snippet has the basic authentication type set, but you are using a different option for the passwd file. Check the links I have above, there should be some examples there that will help.
 

engineereeyore

Platinum Member
Jul 23, 2005
2,070
0
0
Well, for giggles, I changed the permissions to be wide open and tried it again. Still got the same error message.
 

engineereeyore

Platinum Member
Jul 23, 2005
2,070
0
0
Originally posted by: Cheetah8799
I don't know all the details on what you are trying to do, but it sounds like you are maybe making it harder than it needs to be. You could set it up using Apache's Basic Authentication. It's not fancy, but it gets the job done if you don't have a lot of accounts to manage.

Alternatively you could even set it up to connect to a mysql database, ldap or something else for authentication if you need a more manageable or secure solution.

http://httpd.apache.org/docs/2.2/howto/auth.html

http://httpd.apache.org/docs/2.2/mod/mod_auth_basic.html

http://httpd.apache.org/docs/2.2/programs/htpasswd.html



edit: it looks like you are kinda mixing two things up here. Your config snippet has the basic authentication type set, but you are using a different option for the passwd file. Check the links I have above, there should be some examples there that will help.

Yeah, I've set it up using htpasswd, and that worked just fine. It just said that is was using a plain text file, so if you wanted additional security, you should use a dbm file. I really only want this open to a few people, and I guess I shouldn't worry to much about it. I could put the file in a directory well outside of apache and I guess it won't matter if it's plain text or not.

Maybe I'll just do that. You're probably right and it's more trouble than it's worth.