10

I have a Windows service running on my local machine. It's configured to run under NT AUTHORITY\NETWORK SERVICE. The program access a network shared drive on a computer in the same subnet. That shared directory has "Everyone" set to "Full Control."

I'm getting False on File.Exists(), but the file exists. I'm certain this is a permission issue. Am I forgetting anything? The computer with the shared drive is not on a domain.

Michael
  • 239
  • 2
  • 10
Brian T
  • 203
  • 1
  • 2
  • 4

2 Answers2

13

The fact that the machine with the shared drive is not on a domain is where your main problem is. In order to get this to work you will have to configure the Windows Service to run as a specific user, and then you'll have to create an identical user on the remote system with the same password. It might work then.

The problem stems from the fact that in order to log in to a machine not in a domain, you have to log into that machine using an account that exists on that machine. The machine account for something else definitely won't exist on that local machine. By creating an identical user with an identical password, you might be able get the login to work.

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
  • 2
    Thanks sysadmin. You are correct. Once I created an identical account on both machines, it worked. So the ideal situation would be to have the network share and the windows server (where the service is running on) to be in the same domain. Then I would create a domain user account to run the service and has access to the share. – Brian T Sep 01 '10 at 22:01
  • Yes indeed. If they were in the same domain, you could follow tony roth's advice; set it up like you had (network service) and then grant the machine-account the rights on the remote machine. – sysadmin1138 Sep 01 '10 at 22:06
0

change it to run as local system then assign the machineaccount$ to the correct permisions on the share/NTFS permissions notice the highlight on NTFS that has to be covered also.

tony roth
  • 3,884
  • 18
  • 14