NRPE - Launch BAT as current user

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
mscf
Posts: 10
Joined: Thu Feb 19, 2015 2:53 pm

NRPE - Launch BAT as current user

Post by mscf »

I'm working on setting up NRPE to re-launch a particular program when it goes offline for whatever reason. The remote machines are Windows 7 boxes. I thought I had it, it was working when i used "nscp test" to monitor things. But then when I tried it with nscp running as a service, it ran the script (and corresponding EXE file) as SYSTEM. Any idea how to get it to launch as the current user?

FYI, the BAT file that i'm running is just a simple start /d "path" program.exe
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: NRPE - Launch BAT as current user

Post by jdalrymple »

Code: Select all

runas /noprofile /user:someuser start "path" program.exe
??
mscf
Posts: 10
Joined: Thu Feb 19, 2015 2:53 pm

Re: NRPE - Launch BAT as current user

Post by mscf »

I didn't think about using the BAT file to control the runas. I was locked into looking at nrpe. Anyways, that does work, but pops up asking for a password. Aside from an @echo statement that contains the password, do you happen to know of a way to just pick up the current user profile?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: NRPE - Launch BAT as current user

Post by jdalrymple »

There is going to be no way because the NSClient++ (I assume) process isn't running in the context of that user.
mscf
Posts: 10
Joined: Thu Feb 19, 2015 2:53 pm

Re: NRPE - Launch BAT as current user

Post by mscf »

That is unfortunate. Given that the users don't know the password (these are kiosk machines), do you happen to know of a way to launch without prompting for passwords? I thought I could do it with @echo, but I haven't figured out a way to do that yet.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NRPE - Launch BAT as current user

Post by Box293 »

You could configure the NSClient++ service to run as that user.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mscf
Posts: 10
Joined: Thu Feb 19, 2015 2:53 pm

Re: NRPE - Launch BAT as current user

Post by mscf »

Sorry for the delayed response, I've been driving. Anyways, I tried running the service as the user, but now when I issue check_nrpe commands it seems to want a password. I'm not sure how to pass it one. When I try the check_nrpe command from the CLI, this is what I get:

Enter the password for usernamehere:|

I tried using "echo pw | ./check_nrpe..." but that didn't work either.
mscf
Posts: 10
Joined: Thu Feb 19, 2015 2:53 pm

Re: NRPE - Launch BAT as current user

Post by mscf »

Disregard that. I forgot to change my BAT file back from using the Runas command. That was just feedback from the BAT file.
mscf
Posts: 10
Joined: Thu Feb 19, 2015 2:53 pm

Re: NRPE - Launch BAT as current user

Post by mscf »

Although, oddly enough, that still doesn't work. It launches the process under the correct username, but the user can't see the program. And if you uncheck "Show processes from all users" it hides it, which indicates its not running in the same login session.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: NRPE - Launch BAT as current user

Post by jdalrymple »

Check this checkbox
Attachments
Clipboard01.jpg
Locked