kardianos / service

Run go programs as a service on major platforms.
zlib License
4.41k stars 671 forks source link

Windows service get user home is error ? #381

Closed lnsane closed 7 months ago

lnsane commented 8 months ago

user get user home C:\Users\admin

service get user home C:\WINDOWS\system32\config\systemprofile

why?

solodyagin commented 7 months ago

Everything is correct. The service is registered and running under the system user SYSTEM.

solodyagin commented 7 months ago

I'm not sure, but maybe it will work

options := make(service.KeyValue)
options["Password"] = "Pa$$WoRd"

svcConfig := &service.Config{
    ...
    UserName: "admin",
    Option:   options,
}