Windows Service for writing to shared folders RRS feed

  • Question

  • I create shared folder under first account and write to this folder from another one. I develop windows service but it has no access to write in shared folder. Service can write only when shared folder account login/password and Log On settings of service are identical. How can I tune service to write in shared folder with different account?
    Tuesday, July 14, 2020 4:24 PM

All replies

  • I think you have it backwards. You should find way to grant write access for the account you run the service to that shared folder instead.

    Is the shared folder on the same server as that Windows service? If not, are these two machines joined to the same domain? If they're in the same domain, does the service runs on a "domain users" account?

    Wednesday, July 15, 2020 1:24 AM
  • Account with service has write access for account with shared folder. These machines located in the same local network. I can write to shared folder when I use default windows file manager as user. But my windows service with same user account settings has access to write only when accounts(login/password) are identical.
    Wednesday, July 15, 2020 11:13 AM
  • From your description, I assume your service is writing to another machine on the same network that has not joined to domain.

    First, make sure you have granted "Full Control" for "Authenticated Users" or "Everyone" for that folder to make things easier.

    Now make sure you've created account on the "machine which is sharing folder" with the same username and password as the account you use to run the service. (From your description I assume you've set up Local Policy to allow username and password be sent to remote device to log in there already,

    i.e.: "Network access: Sharing and security model for local accounts" = "Classic").

    Finally, right click the folder, and on the "Security" tab, add the username there and grant it full control.

    Now your Windows Service should be able to write to the folder.

    Wednesday, July 15, 2020 11:23 AM