Search code examples
c#windowsserviceuser-permissionslocal-system-account

What is the name of the account "System.ServiceProcess.ServiceAccount.LocalSystem" in Windows 8.1?


I created a Windows Service Application using VS2013 and set the property ServiceProcessInstaller.Account to System.ServiceProcess.ServiceAccount.LocalSystem and the service don't run until I gave permission to the SYSTEM account.

But I'm doubting if that SYSTEM account is the same account refereed here or referred by this enum value: System.ServiceProcess.ServiceAccount.LocalSystem.


Solution

  • From the MSDN article "LocalSystem Account":

    The LocalSystem account is a predefined local account used by the service control manager. [...] It has extensive privileges on the local computer, and acts as the computer on the network. Its token includes the NT AUTHORITY\SYSTEM and BUILTIN\Administrators SIDs; these accounts have access to most system objects.

    This is drawing a subtle distinction; LocalSystem is the name of the account (as defined by the service control manager; it isn't really an account from the kernel's point of view) whereas SYSTEM is the name of the security ID associated with that account.

    The upshot is that you have to use LocalSystem as the account name when creating or modifying services, but have to use SYSTEM when assigning permissions. (Alternatively, you can grant permission to the Administrators group.)