Re: Service under LocalSystem impersonating NETWORK SERVICE, has no local disk access

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



"Joost" <joostb1979@xxxxxxxxx> wrote in message
news:1127979245.109056.8150@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> I've written a service running under Local System account. It has to
> access the network using WNetAddConnection so I can copy files to/from
> the local disk.
>
> This is what I am doing:
>
> 1. Enumerate the running processes and search for SID S-1-5-20 (NETWORK
> SERVICE)
>
> 2. Use the token of this process in ImpersonateLoggedOnUser(hToken)
>
> 3. Now I can access the network using WNetAddConnection, BUT!!!!, the
> account 'NETWORK SERVICE' has no access to local disks, so the copy
> action fails with 'Access denied'.

All this is not required. If you call WNetAddConnection(), your
impersonation token and even your primary token are completely irrelevant:
the remote system will authenticate the credentials you supplied with
WNetAddConnection().

Even if you did not use WNetAddConnection(), that would not be required,
because the Local System account is exactly the same as Network Service for
networking; the difference is that Local System _also_ has local privileges,
which Network Service does not have.

> My question:
> How can I get access to the network AND the local disks?

If you are in a domain environment, run as Local System and make sure that
the machine account has access to the remote machine; or run as Local
Service and use WNetAddConnection() to authenticate yourself. The latter
approach will work in non-domain environments, too.

S



.



Relevant Pages

  • Re: c# widows services...
    ... to access network resources. ... Another major difference when running under the Local System account is ... that you don't have access to the desktop session of the ...
    (microsoft.public.dotnet.languages.csharp)
  • Service under LocalSystem impersonating NETWORK SERVICE, has no local disk access
    ... I've written a service running under Local System account. ... Enumerate the running processes and search for SID S-1-5-20 (NETWORK ... Now I can access the network using WNetAddConnection, BUT!!!!, the ... How can I get access to the network AND the local disks? ...
    (microsoft.public.win32.programmer.kernel)
  • Cant use the copy database wizard
    ... Your SQl server is running under the local system account, ... You need to change your sql server Service account to have the rights to ... We do not have a domain server on this small network and don't want to ...
    (microsoft.public.sqlserver.security)
  • Re: Why Disable Root ssh login?
    ... For the logs, if the local system is able to send some log to another network, a user having root access is also able too; how can the local system be "authorized" to send remote log across the network and denying this to a user having rootlocal access. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)
  • NT AUTHORITY never gets access
    ... updates and driver updates to XP had been installed as of ... I selected the repair installation, ... I tried to reinstall the wireless network, ... Logon as Local System Account fail. ...
    (microsoft.public.windowsxp.security_admin)