Re: Service accessing mapped network drives
- From: "Alexander Nickolov" <agnickolov@xxxxxxxx>
- Date: Tue, 3 Oct 2006 10:15:50 -0700
That's not a user account - you access the network using the
computer's account. On the remote machine add your service
machine's computer account to the share's ACL and grant it
access (unless you have Everyone that is). Same for the underlying
file system permissions.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Peter_SMT" <PeterSMT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:417CCA63-0B05-4EF0-8F3A-0FC7BB8B4E56@xxxxxxxxxxxxxxxx
All,
Accessing a remote share presents another problem.
The service should normally be running as a non interactive local user
(say
NT AUTHORITY/NETWORK SERVICE on XP). While as an inteactive user you may
have
the access rights to browse to that share the service may not without
first
providing the proper credentials.
How would it be possible to discover that a share requires credentials to
be
supplied? For instance in a windows UI that the interactive user uses to
set
up the service - supplying a UNC path - how can you know that the user
should
be prompted for a username and password for the share so that the service
can
connect?
This problem is currently wrecking my head!
Any suggestions would be very useful.
Thanks,
Peter
"JJ" wrote:
No, it's a difference in the way mapped drives now work (mapped drives
are a
remnant from LAN Manager days).
With NT and Win2000, drive letters were global to the entire system. You
couldn't have one login session map drive N: to one place and another
session on the same system map drive N: to a different place. (In
addition,
I think it was supposed to be that only the login session that created
the
map could access the map, even though other sessions would still see that
it
existed. This seemed work inconsistently to me - theoretically, your
service should not have been able to use drives mapped by the interactive
user. I mostly saw this short circuited when the drives were mapped to a
Samba share on a Unix system - I'm not sure why that was different.)
In XP, Win2003, and later, each login session gets its own set of unique
drive maps. Since your service is executing in its own login session, it
does not see the maps created by the interactive user. The service would
have to create its own maps if it needed them (using WNetAddConnection2()
for example). But a better option is to use UNC path names
(\\server\share\directory\filename) instead of the drive map.
See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/services_and_redirected_drives.asp
"Dan" <Dan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FBBBDF1B-7CA0-4E96-B227-DA3EBA409F93@xxxxxxxxxxxxxxxx
I have a service (running under an user account) which needs to access
several mapped network drives. It actually worked w/o problems in the
past,
but now it can't access them anymore. I've read that a service should
not
access such drives under XP, but that's not really "helpful".
So my question is, is there a solution for this? And was there an
update
for
XP that might have broken things?
Thanks in advance.
.
- Follow-Ups:
- Re: Service accessing mapped network drives
- From: Alexander Nickolov
- Re: Service accessing mapped network drives
- Prev by Date: asynchronous socket I/O call which returns immediately without WSA_IO_PENDING
- Next by Date: Re: WSASend : Problem Sending first packet not delivered to until second Send
- Previous by thread: asynchronous socket I/O call which returns immediately without WSA_IO_PENDING
- Next by thread: Re: Service accessing mapped network drives
- Index(es):
Relevant Pages
|