I have a Windows Service running as Local System on SERVER_X which is attempting to access a script on a UNC share hosted on SERVER_Y.
Per the links below, I've granted the computer account of SERVER_X access to the UNC on SERVER_Y.
How to grant network access to LocalSystem account?
How do I grant access to shared folder for local SYSTEM account in domain network
But, the Windows Service is unable to access the file (access denied errors).
dir \\SERVER_X\share
Access is denied.
In the Security Event log (on SERVER_Y) I see that SERVER_X is trying to access the UNC share as NT AUTHORITY\ANONYMOUS LOGON. I would think that I should see the computer account (i.e. DOMAIN\SERVER_X) in the Security Event log.
Both servers are Windows Server 2003 SE SP2.
Any help would be greatly appreciated!
I found this Microsoft Blog which got me looking at using the server's hostname vs. CNAME.
Specifically, the below snippets:
And...
And...
Note: When on a Windows Server 2008 host I could execute the dir command using the CNAME successfully.
SOLUTION 1:
Use hostname instead of CNAME.
I verified that if from a Windows Server 2003 host I accessed the UNC share with the hostname (i.e.
\\HOSTNAME\share
) instead of the CNAME (i.e.\\CNAME\share
), the access would work fine.Example - WORKED:
Example - DID NOT WORK:
SOLUTION 2:
Set a SPN (service principal name) for the CNAME.
After doing this the
dir \\CNAME\share
worked.Also see How to Configure Windows Machine to Allow File Sharing with DNS Alias for more information.
Because when you access a UNC share without previously established network credentials, you end up as anonymous. The local SYSTEM account obviously isn't a valid network login.
Run the service under an user account to bypass the problem.