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
NRPE - Launch BAT as current user
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: NRPE - Launch BAT as current user
Code: Select all
runas /noprofile /user:someuser start "path" program.exeRe: NRPE - Launch BAT as current user
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
There is going to be no way because the NSClient++ (I assume) process isn't running in the context of that user.
Re: NRPE - Launch BAT as current user
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.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: NRPE - Launch BAT as current user
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.
Re: NRPE - Launch BAT as current user
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.
Enter the password for usernamehere:|
I tried using "echo pw | ./check_nrpe..." but that didn't work either.
Re: NRPE - Launch BAT as current user
Disregard that. I forgot to change my BAT file back from using the Runas command. That was just feedback from the BAT file.
Re: NRPE - Launch BAT as current user
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