who does NSClient++ run scripts as?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
jriker1
Posts: 115
Joined: Tue Dec 15, 2015 8:40 pm

who does NSClient++ run scripts as?

Post by jriker1 »

I am trying to reboot my server (part of another thread), but had a question thought could stand on it's own. I have a batch reboot bat file that uses psshutdown.exe to reboot the server.

If I run the batch file on my computer thru a standard dos window it returns access denied.

If I run the batch file from a dos windows that I selected open as Administrator, it reboots instantly.

When I call the script what is nrpe using for the account that is running the bat file. I am not seeing it function and thinking permissions to complete the task may be an issue.

Thanks.

JR
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: who does NSClient++ run scripts as?

Post by bwallace »

By default, I believe NSCLIENT runs as Local System

http://docs.nsclient.org/tutorial/core/ ... g-nsclient
Be sure to check out the Knowledgebase for helpful articles and solutions!
jriker1
Posts: 115
Joined: Tue Dec 15, 2015 8:40 pm

Re: who does NSClient++ run scripts as?

Post by jriker1 »

Thanks, so even though my account is an admin (domain admin) of the box, it still requires open as admin to be selected in order to reboot from a bat file. If I set the service to run as my admin account will it work considering the above, or do I physically have to have NSClient++ run as local admin? Being a domain controller local admin is probably disabled. Thanks.

Note tried running "C:\Program Files\NSClient++\nscp.exe" test
without run as admin and gave all kinds of errors. When I opened a dos windows "as admin" and ran it came up waiting for command.

Sent a "reboot" which is the name of the script and rebooted the computer but guessing that's because of the way I manually called NSClient.

Thoughts?

JR
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: who does NSClient++ run scripts as?

Post by rkennedy »

I believe this falls into the windows security settings. The service does indeed run as local system, as @bwallace mentioned. I am not having the same issue you are as I try to replicate, but I do have local admin. I suspect your domain admins group might not have the right permissions.

Under a normal eleveated prompt (not admin), I am seeing the following result (last few lines) -

Code: Select all

D       core NSClient++ - 0.4.4.15 2015-11-25 Started!
D       core C:\Program Files\NSClient++/modules\CommandClient.dll.dll
D       core adding C:\Program Files\NSClient++/modules\CommandClient.dll
D       core Loading plugin: CommandClient.dll...
D        cli Enter command to execute, help for help or exit to exit...

From here, I can run any check command I otherwise would without an issue.

In your environment, can you post the output of this command ran in powershell?

Code: Select all

get-acl -path 'C:\Program Files\NSClient++\' | format-list
When I call the script what is nrpe using for the account that is running the bat file. I am not seeing it function and thinking permissions to complete the task may be an issue.
We do like to keep topics contained to one issue, so please try to keep this specifically to your question, and the reboot script separate.
Former Nagios Employee
Locked