makefun
makefun

Reputation: 133

Network access to windows service

I have problem with creating service that has access to files on network disk.

Service must have admin rights and it will be run by users that don't have admin privileges.

I send path as UNC and file is seen by service but it return ACCES_DENIED errors when try to open or do anything on Network drive.

When I run my service as server , everything works fine.

I try to find answer but everywhere I can found only partial answers that do not help me at all.

========

I read that standard service logged as SYSTEM can't have access to network. So i tried to log id as

  1. NetworkService, LocalService It didn't work. After run it as one of those user my service can't save files on c:
  2. Some kind of admin account.But I didn't manage to success on that.
  3. Actually logged user. I don't know how to get password for current user. Still this will not work for user without admin rights.

========

Please tell me what can I do? There are plenty of Services that use somehow network resources. How do they do that?

Upvotes: 1

Views: 4130

Answers (2)

Sarfaraz Ansari
Sarfaraz Ansari

Reputation: 129

For me, the port was getting blocked through firewall, I had to add a inbound rule and specify the port which i was using in my application. This way firewall did not blocked my port for outgoing connections.

References:

https://www.firehousesoftware.com/webhelp/FH/Content/FHEnterprise/FHEnterpriseInstallationGuide/24_StaticPort.htm

Upvotes: 0

David Heffernan
David Heffernan

Reputation: 612814

You need to configure your service to run as a user which has sufficient rights. In this case you are looking for rights to network shares. Typically that's going to need a domain user with appropriate rights. Normally you'd ask your network manager to create a dedicated user account for the purpose.

You appear to be labouring under some false information as to how services work. You talk about running the service under the account of the logged on user. Remember that services run when there are no users logged on. And remember that there may be multiple logged users at any point in time.

Upvotes: 3

Related Questions