Re: Service accessing mapped network drives

Tech-Archive recommends: Fix windows errors by optimizing your registry



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.





.



Relevant Pages

  • Re: Service accessing mapped network drives
    ... Microsoft MVP, MCSD ... session on the same system map drive N: ... I think it was supposed to be that only the login session that created ... I mostly saw this short circuited when the drives were mapped to ...
    (microsoft.public.win32.programmer.networks)
  • Re: windows xp security model in workgroup setting
    ... the account used to map the shares exists on both hosts but *is not* the same account that the locally logged on user uses. ... when i browse in windows explorer, i can see the mapped drives. ... map the drive using the name and password of the user who's logged in to the computer. ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Service accessing mapped network drives
    ... session on the same system map drive N: ... I think it was supposed to be that only the login session that created the ... service should not have been able to use drives mapped by the interactive ... But a better option is to use UNC path names ...
    (microsoft.public.win32.programmer.networks)
  • Re: Service accessing mapped network drives
    ... fact that I can't use the "map network" in XP to access files from my office ... I think it was supposed to be that only the login session that created ... service should not have been able to use drives mapped by the interactive ... several mapped network drives. ...
    (microsoft.public.win32.programmer.networks)
  • Re: Windows service Unable to access mapped drives on XP and 2003
    ... But I was just wondering why does it work on windows 2000 and not on windows ... > Share mappings are login session bound, that means that if you map a shared ... > EVEN if the service account is the SAME as the interactive Logon. ... >> The mapping is not done from within the service.I have mapped the drives ...
    (microsoft.public.dotnet.framework)