Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

access network share in apache

2 views
Skip to first unread message

Daniel Doman

unread,
Jul 21, 2003, 10:18:38 PM7/21/03
to
I can't seem to get this to work. I have an apache 2.x running under
windows2000 and want to access a share on another windows machine as an
alias. I created a user called webservice on both machines with all of the
access rights that I can think of. I have Apache running under the
webservice user account, but the alias does not work. In fact, Apache won't
even start unless the following is done - If I map a drive using "login
as" as the webservice account to the other machine. It doesn't matter what
I map to, what it does is create an IPC$ connection and then Apache will
start and the Alias will work.

I've seen various presentations of the syntax but there is surprisingly
little about this on the web that I could find.

I found that the alias as \\server\share and directory as \\server\share
did not work no matter what

alias as //server/share and directory as //server/share would work, but
then only if I first map a drive or make an IPC$ connection. What am I
missing?

dan

The Other Guy

unread,
Jul 21, 2003, 10:54:07 PM7/21/03
to
On Tue, 22 Jul 2003 02:18:38 +0000 (UTC), The Other Guy responded to a
post from Daniel Doman <ddo...@pbonk.com> who wrote in
comp.infosystems.www.servers.ms-windows:

If I understand correctly, you want to alias a mapped drive that is
based on a UNC: e.g., \\other_server\some_folder (this is how you
would normally map a network drive).

It should be possible to do this. You need to use the Alias directive,
e.g.,:
Alias /fakename/ "w:/somefolder/"
or
Alias /fakename "w:/somefolder"
The difference is, if the first arg ends with a trailing slash, then
the other needs to, as well.


Your problem may be that you must change the account that the Apache
service runs under to an account with network access (System accounts
can't access network resources so a shared page(s) or a shared
installation of Apache is invisible to the service). See
http://httpd.apache.org/docs-2.0/platform/win_service.html about user
accounts. Essentially, the default system svc account doesn't (and
shouldn't) have network privileges.

See http://httpd.apache.org/docs-2.0/platform/windows.html

Usually, you will need to run the Apache service as a domain user
instead of "Local System" in order to do this. You need to make sure
that the domain user has been granted access to the share you need to
access. In other words, you would run the Apache service as a user who
is granted access to the given network resource. Don't use the 'guest'
account, but you can copy *from* guest to create the apache user.


Go to the Start --> Settings --> Control Panel --> Admin Tools -->
Services,
and choose the Apache service properties, and choose another user to
run the server as.


I would also suggest using the network file share name (but note you
shouldn't use backslashes in \\server\share, but you should change
them to forward slashes), as opposed to drive letters. I find that
drive letters get changed, remapped or screwed up in general and so I
make it a habit/rule to always use the share name. You should use a
newer version of Apache 2 (e.g., 2.0.43) for this, however, as earlier
ones really had problems with UNC names, especially starting as
service (on early Apache versions, you will likely have to use drive
letters for Aliasing).


You will most likely need to add a Directory container as well (this
may be also where your problem lies):

<Directory "w:/some/directory/">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Your Options may vary, as well as AllowOverride if you have
Authentication. Also, I think that there has been some previous
discussions about *not* having Indexes in the Options for security
reasons. I can't remember, it's been a long time.

If using backslashes, in some cases, you may need to escape
backslashes, which usually means double backslashes; so a UNC path
like

\\SOMEMACHINE\someshare

would be

\\\\SOMEMACHINE\\someshare


Alternatively, if you really want to give access to that directory
from the internet, you can make it the document root for a virtual
host or something.


In summary, try using UNC paths, be certain you've created an Apache
user, and associate the account with your Apache Group. Be sure the
program has list access to all directories above any Apache
directories (it walks the entire path to check proper filename case),
and the Apache service is configured to 'run as user' Apache. You
might try W2K's run-as feature to run the apache -t command (to see
the errors).

Finally, check to make sure that you have the mod_alias module which
is needed for this.

http://httpd.apache.org/docs/urlmapping.html

HTH
TOG

--
./configure --prefix=~/zyterion
Not this guy or that guy, The Other Guy.

"If you're not thoroughly confused by now, then you just
don't understand the situation."

0 new messages