-
-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get running as specific user to work #89
Comments
You're probably better off looking for the last element in the path than hardcoding the 3rd element: var username = process.env.USERPROFILE.split(path.sep).pop(); The code above will split the string and return the last "directory", which should match up with the username. |
OK, thanks for that. So now the username prints out as "systemprofile" rather than "system32" from app.js even if I specify my domain/username/password via the Service's user object in my service.js file. So, service.js prints out my username, but app.js prints out systemprofile, with or without me explicitly setting a domain/user/password. Any idea what I need to do to get app.js to run as my user? Thanks a bunch. |
Hi, any update on this corey? If you follow my repro steps, can you get app.js to run as a specific user? Any help would be much appreciated, as this will make a feature I've been working on a lot more useful. |
If you open the windows services, right click on the service name, and look at the properties, which user account is the script setup to run as? |
So I finally figured this part out and it was NOT set to my username. It was the default/system user. On Mon, May 25, 2015 at 11:55 AM, Corey Butler notifications@github.com
|
That's what I was guessing... glad you figured it out! |
But setting the username in the node-windows settings doesn't work, because even with my credentials and domain, it installs the service as the system user. So there still may be a bug here. On Mon, May 25, 2015 at 5:09 PM, Corey Butler notifications@github.com
|
mmm... |
@doArcanjo - I don't really know... node-windows only supports versions of Windows that haven't reached EOL. I haven't (nor intend to) looked at intricacies of supporting anything prior to Windows 7. |
This is 7. On Tue, May 26, 2015 at 4:07 PM, Corey Butler notifications@github.com
|
7 and 8, and 8.1 not xp althought |
Wat On Wed, May 27, 2015 at 7:33 AM, doArcanjo notifications@github.com
|
I was just commenting on @doArcanjo's post on the article, which is referencing Vista. |
winsw has an option in the XML called serviceaccount which it looks like node-windows isn't setting. |
@griff I'm actually running into this issue right now, and I tried to modify the code to add the option. However, the service still starts running as local system. Would you happen to have any thoughts? |
@liu-jianyang It's not possible to change the owner of the service process (which is managed in Services management console) inside javascript code. The idea behind |
Ah ok, that helps, thanks. So there is no way to change the owner via javascript? |
Oh! You mean at the time of windows service installation! There must be a cmd line script switch (install |
The documentation says this:
By default, it will run using the user account that launched the process (i.e. who launched node app.js).
However, if I put this in app.js:
And log it, I get 'system32' rather than my username.
If I put that same printout in the appservice.js file (which creates the Service object, etc), it prints the username I would expect, which is my username.
I've tried explicitly overriding the Service instance's user object with my credentials and domain name, but that doesn't help either. I get 'system32' in that case as well.
Anyone know if this is a bug, or if I'm doing something wrong?
Thanks in advance!
The text was updated successfully, but these errors were encountered: