# [RESOLVED/FIXED] apache 2.2.9 mod_authn_file

## jlpoole

How can I get the Apache Directive AuthUserFile to work for apache 2.2.9-r1?

My Apache server, after updating some time ago as I ride the high water mark of portage, stopped working on authenticating via user files.  I haven't had much to dig around to find the root of the problem and have now determined that omission of the module mod_authn_file http://httpd.apache.org/docs/2.2/mod/mod_authn_file.html from my Apache instance is the problem.

I do not understand why mod_authn_file is ommitted or missing.

After I emerged twiki, I learned that twiki expects the Apache Directive "AuthUserFile"

from the ...twiki/twiki_httpd.conf (redacted):

```
   # Password file for TWiki users

   AuthUserFile [b].../[/b]htdocs/twiki/data/.htpasswd

   AuthName 'Enter your WikiName: (First name and last name, no space, no dots, capitalized, e.g. JohnSmith). Cancel to register if you do not have one.'

   AuthType Basic
```

and when I try to start the Apache server, it croaks with (redacted):

```

Syntax error on line 63 of [b].../[/b]htdocs/twiki/twiki_httpd.conf:

Invalid command 'AuthUserFile', perhaps misspelled or defined by a module not included in the server configuration

```

My httpd.conf has, in part:

```
...

# Dynamic Shared Object (DSO) Support

#

# To be able to use the functionality of a module which was built as a DSO you

# have to place corresponding `LoadModule' lines at this location so the

# directives contained in it are actually available _before_ they are used.

# Statically compiled modules (those listed by `httpd -l') do not need

# to be loaded here.

#

# Example:

# LoadModule foo_module modules/mod_foo.so

#

# GENTOO: Automatically defined based on APACHE2_MODULES USE_EXPAND variable.

#         Do not change manually, it will be overwritten on upgrade.

#

# The following modules are considered as the default configuration.

# If you wish to disable one of them, you may have to alter other

# configuration directives.

#

# Change these at your own risk!

LoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.so

LoadModule asis_module modules/mod_asis.so

LoadModule auth_basic_module modules/mod_auth_basic.so

<IfDefine AUTH_DIGEST>

LoadModule auth_digest_module modules/mod_auth_digest.so

</IfDefine>

<IfDefine AUTHNZ_LDAP>

LoadModule authnz_ldap_module modules/mod_authnz_ldap.so

</IfDefine>

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule autoindex_module modules/mod_autoindex.so

<IfDefine CACHE>

LoadModule cache_module modules/mod_cache.so

</IfDefine>

LoadModule cgi_module modules/mod_cgi.so

<IfDefine DAV>

LoadModule dav_module modules/mod_dav.so

</IfDefine>

LoadModule dbd_module modules/mod_dbd.so

LoadModule deflate_module modules/mod_deflate.so

LoadModule dir_module modules/mod_dir.so

LoadModule env_module modules/mod_env.so

LoadModule expires_module modules/mod_expires.so

LoadModule filter_module modules/mod_filter.so

LoadModule headers_module modules/mod_headers.so

LoadModule include_module modules/mod_include.so

<IfDefine INFO>

LoadModule info_module modules/mod_info.so

</IfDefine>

<IfDefine LDAP>

LoadModule ldap_module modules/mod_ldap.so

</IfDefine>

LoadModule log_config_module modules/mod_log_config.so

LoadModule logio_module modules/mod_logio.so

LoadModule mime_module modules/mod_mime.so

LoadModule negotiation_module modules/mod_negotiation.so

<IfDefine PROXY>

LoadModule proxy_module modules/mod_proxy.so

</IfDefine>

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule setenvif_module modules/mod_setenvif.so

LoadModule speling_module modules/mod_speling.so

<IfDefine SSL>

LoadModule ssl_module modules/mod_ssl.so

</IfDefine>

<IfDefine STATUS>

LoadModule status_module modules/mod_status.so

</IfDefine>

LoadModule unique_id_module modules/mod_unique_id.so

<IfDefine USERDIR>

LoadModule userdir_module modules/mod_userdir.so

</IfDefine>

LoadModule usertrack_module modules/mod_usertrack.so

```

Moreover, my directory /usr/lib/apache2/modules does not have the module, mod_authn_file.so:

```
daphne modules # pwd

/usr/lib/apache2/modules

daphne modules # ls -la

total 1257

drwxr-xr-x 2 root root   1392 Oct 18 15:05 .

drwxr-xr-x 4 root root    128 Apr 15  2008 ..

-rwxr-xr-x 1 root root   9564 Sep  2 12:12 mod_actions.so

-rwxr-xr-x 1 root root   9596 Sep  2 12:12 mod_alias.so

-rwxr-xr-x 1 root root   5380 Sep  2 12:12 mod_asis.so

-rwxr-xr-x 1 root root   9564 Sep  2 12:12 mod_auth_basic.so

-rwxr-xr-x 1 root root  26128 Sep  2 12:12 mod_auth_digest.so

-rwxr-xr-x 1 root root  10436 Oct 30  2006 mod_auth_external.so

-rwxr-xr-x 1 root root  25315 May  4 05:11 mod_auth_pgsql.so

-rwxr-xr-x 1 root root  77228 Jun  6  2004 mod_authn_dbi.so

-rwxr-xr-x 1 root root  26076 Sep  2 12:12 mod_authnz_ldap.so

-rwxr-xr-x 1 root root   9564 Sep  2 12:12 mod_authz_host.so

-rwxr-xr-x 1 root root  13692 Oct 18 15:05 mod_authz_svn.so

-rwxr-xr-x 1 root root  30268 Sep  2 12:12 mod_autoindex.so

-rwxr-xr-x 1 root root  30320 Sep  2 12:12 mod_cache.so

-rwxr-xr-x 1 root root  22076 Sep  2 12:12 mod_cgi.so

-rwxr-xr-x 1 root root  87868 Sep  2 12:12 mod_dav.so

-rwxr-xr-x 1 root root 137772 Oct 18 15:05 mod_dav_svn.so

-rwxr-xr-x 1 root root  13756 Sep  2 12:12 mod_dbd.so

-rwxr-xr-x 1 root root  21948 Sep  2 12:12 mod_deflate.so

-rwxr-xr-x 1 root root   5436 Sep  2 12:12 mod_dir.so

-rwxr-xr-x 1 root root   5436 Sep  2 12:12 mod_env.so

-rwxr-xr-x 1 root root   9648 Sep  2 12:12 mod_expires.so

-rwxr-xr-x 1 root root  13692 Sep  2 12:12 mod_filter.so

-rwxr-xr-x 1 root root  40810 Jan 30  2007 mod_frontpage.so

-rwxr-xr-x 1 root root  13756 Sep  2 12:12 mod_headers.so

-rwxr-xr-x 1 root root  42524 Sep  2 12:12 mod_include.so

-rwxr-xr-x 1 root root  17984 Sep  2 12:12 mod_info.so

-rwxr-xr-x 1 root root  46716 Sep  2 12:12 mod_ldap.so

-rwxr-xr-x 1 root root  22072 Sep  2 12:12 mod_log_config.so

-rwxr-xr-x 1 root root   5420 Sep  2 12:12 mod_logio.so

-rwxr-xr-x 1 root root  13724 Sep  2 12:12 mod_mime.so

-rwxr-xr-x 1 root root  30236 Sep  2 12:12 mod_negotiation.so

-rwxr-xr-x 1 root root  71600 Sep  2 12:12 mod_proxy.so

-rwxr-xr-x 1 root root  59132 Sep  2 12:12 mod_rewrite.so

-rwxr-xr-x 1 root root   9596 Sep  2 12:12 mod_setenvif.so

-rwxr-xr-x 1 root root   9596 Sep  2 12:12 mod_speling.so

-rwxr-xr-x 1 root root 154788 Sep  2 12:12 mod_ssl.so

-rwxr-xr-x 1 root root  21968 Sep  2 12:12 mod_status.so

-rwxr-xr-x 1 root root   9532 Sep  2 12:12 mod_unique_id.so

-rwxr-xr-x 1 root root   9564 Sep  2 12:12 mod_userdir.so

-rwxr-xr-x 1 root root   9596 Sep  2 12:12 mod_usertrack.so

daphne modules #                     
```

Is anyone else using apache 2.2.9-r1 and missing mod_authn_file?  I think I've been using the updates to the configuration files, though it is possible I did not.  Perhaps anyone reading this who has 2.2.9-r1 installed could verify if their httpd.conf file omits mod_authn_file.

Thanks!

================ updated ================

The problem concerned my Apache2 USE variables.  

Solution: see what USE variables were used when you installed your version:

```
emerge --verbose --pretend apache
```

If your module that you want is not there, then add it by editing /etc/make.conf at the APACHE2_MODULES="..." portion.

I found thatn "authn_file" was not present, so I added it then re-emerged apache:

```
 emerge --newuse apache
```

Come time for the update to the configuration file, dispath-config simply added the line:

 *Quote:*   

> LoadModule authn_file_module modules/mod_authn_file.so

 

and apache was back in order with a compiled authn_file.so.

----------

