2

Thus far my C# service finally does everything it's supposed to except it's obviously having some access problems due to the following in the installer code:

            processInstaller.Account = ServiceAccount.LocalSystem;

Ordinarily, this looks like a time to follow the simple directions here, but in this instance, the end users don't know their own passwords--smart cards are used for login. On such a machine, I seem to be able to run around and merrily install whatever applications I wish, and my processes seem to run just fine when I log out.

Is there some way I can give the service the permissions of the user who installs it without compiling them into the code or prompting for them?

This was originally going to be a nice little tray app but then it turned out it needs to be able to run in the event the user has rebooted their machine and hasn't even yet logged in while having access to the user's personal files and network shares.

Community
  • 1
  • 1
UtopiaLtd
  • 2,520
  • 1
  • 30
  • 46
  • To clarify as to the network shares, network drive paths have already been converted to their actual network address beforehand. The service just needs permission to access. – UtopiaLtd Oct 04 '11 at 16:16

1 Answers1

3

Sorry, can't be done in this way without a prompt.

See Install Windows service to run under user's credentials with ServiceAccount.User but don't prompt

Only other option is to run as a network service and constrain your permissions.

Community
  • 1
  • 1
Polynomial
  • 27,674
  • 12
  • 80
  • 107
  • If it wouldn't be against local security policy to do so (and that's a big if), is there some way to invoke the Windows Login Smart Card prompt instead of user/password? – UtopiaLtd Oct 04 '11 at 16:18
  • 2
    Windows Service instances don't have the ability to log in using any authentication method except user/password. – Polynomial Oct 04 '11 at 23:04