Remote command execution failed: Permission denied,please...

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.
rajesh.mehra
Posts: 35
Joined: Mon Jan 27, 2014 2:38 am
Location: New Delhi, India

Re: Remote command execution failed: Permission denied,pleas

Post by rajesh.mehra »

Post output here of error when su - nagios
rajesh.mehra
Posts: 35
Joined: Mon Jan 27, 2014 2:38 am
Location: New Delhi, India

Re: Remote command execution failed: Permission denied,pleas

Post by rajesh.mehra »

:D Your problem is going to solve in coming posts
aleks1
Posts: 43
Joined: Thu Nov 28, 2013 1:33 pm

Re: Remote command execution failed: Permission denied,pleas

Post by aleks1 »

Your problem is going to solve in coming posts
i hope!!! :):):)
Post output here of error when su - nagios
when i try to use the command su - nagios...... nothing happens!! :(

Code: Select all

root@maestro:~# su - nagios
root@maestro:~# 
and i don't know why the command:

Code: Select all

id nagios
uid=121(nagios) gid=124(nagios) groups=124(nagios)
why i can't switch to nagios user but the command id nagios says the information above?
Stuart Watts
Posts: 40
Joined: Wed Sep 25, 2013 7:01 am

Re: Remote command execution failed: Permission denied,pleas

Post by Stuart Watts »

Forums ate my first response - I had to re-type it (although it may have been a Layer 8 problem here ;) ).

You're getting the same error from the plugin as your command and service definitions are synonymous - they're both exactly the same. Welcome Nagios! It's like Perl sometimes - many different ways to skin many different cats! ;)

Firstly - make sure the plugin you're executing on the remote server has the execute bit set:

Code: Select all

ls -l /usr/local/nagios/libexec/check_nagios
Secondly, there's clearly something wrong with your local "nagios" user. Can you provide the output from:

Code: Select all

getent passwd nagios
aleks1
Posts: 43
Joined: Thu Nov 28, 2013 1:33 pm

Re: Remote command execution failed: Permission denied,pleas

Post by aleks1 »

Forums ate my first response - I had to re-type it (although it may have been a Layer 8 problem here ;) ).
:)
Firstly - make sure the plugin you're executing on the remote server has the execute bit set:
ok on my remote server backups:

Code: Select all

root@backups:/usr/local/nagios/etc# ls -l /usr/local/nagios/libexec/check_nagios-rwxr-xr-x 1 nagios nagios 124350 mag 19 12:02 /usr/local/nagios/libexec/check_nagios
and on nagios server (implemented not by me :) ) :

Code: Select all

root@maestro:/usr/lib/nagios/plugins# getent passwd nagios
nagios:x:121:124::/var/lib/nagios:/bin/false
oh what does it mean?
Last edited by aleks1 on Thu Jun 12, 2014 8:01 am, edited 1 time in total.
rajesh.mehra
Posts: 35
Joined: Mon Jan 27, 2014 2:38 am
Location: New Delhi, India

Re: Remote command execution failed: Permission denied,pleas

Post by rajesh.mehra »

try this command

Code: Select all

su - nagios -s /bin/bash
aleks1
Posts: 43
Joined: Thu Nov 28, 2013 1:33 pm

Re: Remote command execution failed: Permission denied,pleas

Post by aleks1 »

try this command

Code: Select all
su - nagios -s /bin/bash

Code: Select all

root@maestro:/usr/lib/nagios/plugins# su - nagios -s /bin/bash
nagios@maestro:~$ 
hey works! and then? run this command? :)

Code: Select all

/usr/lib/nagios/plugins/check_by_ssh -4 -H remote address -l root -p 2022 -C "/usr/local/nagios/libexec/check_nagios -t 20 -e 5 -F /usr/local/nagios/var/nagios.log -C /usr/local/nagios/bin/nagios" -vvvvvvvvvvvvvvvvvvvvv
rajesh.mehra
Posts: 35
Joined: Mon Jan 27, 2014 2:38 am
Location: New Delhi, India

Re: Remote command execution failed: Permission denied,pleas

Post by rajesh.mehra »

:) yes run this command

Code: Select all

/usr/lib/nagios/plugins/check_by_ssh -H intranet.xx.xx -l root -p 2022 -C "/usr/local/nagios/libexec/check_nagios -t 20 -e 5 -F /usr/local/nagios/var/nagios.log -C /usr/local/nagios/bin/nagios" -vvvvvvvvv 
aleks1
Posts: 43
Joined: Thu Nov 28, 2013 1:33 pm

Re: Remote command execution failed: Permission denied,pleas

Post by aleks1 »

i read you in mind!! :)

Code: Select all

nagios@maestro:~$ /usr/lib/nagios/plugins/check_by_ssh -4 -H intranet.xx.xx -l root -p 2022 -C "/usr/local/nagios/libexec/check_nagios -t 20 -e 5 -F /usr/local/nagios/var/nagios.log -C /usr/local/nagios/bin/nagios" -vvvvvvvvvvvvvvvvvvvvv
Command: /usr/bin/ssh
Argument 1: -4
Argument 2: -l
Argument 3: root
Argument 4: -p
Argument 5: 2022
Argument 6: intranet.xx.xx
Argument 7: /usr/local/nagios/libexec/check_nagios -t 20 -e 5 -F /usr/local/nagios/var/nagios.log -C /usr/local/nagios/bin/nagios
root@intranet.xx.xx's password: 
NAGIOS OK: 41 processes, status log updated 200 seconds ago
nagios@maestro:~$ 
it will ask password
yes! :) and then! :)
rajesh.mehra
Posts: 35
Joined: Mon Jan 27, 2014 2:38 am
Location: New Delhi, India

Re: Remote command execution failed: Permission denied,pleas

Post by rajesh.mehra »

Follow it Change according to your configuration

Note Enter passphrase (empty for no passphrase): Leave it blank do not set password

Code: Select all

[nagios@jtm01~]$  ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/nagios/.ssh/id_dsa):
Enter passphrase (empty for[b] no passphrase)[/b]:
Enter same passphrase again:
Your identification has been saved in /home/nagios/.ssh/id_dsa.
Your public key has been saved in /home/nagios/.ssh/id_dsa.pub.
The key fingerprint is:
f4:94:48:ef:d8:be:1b:06:11:5f:7a:30:42:ca:08:64 nagios@jtm01
[nagios@jtm01 ~]$ scp -P 2022 /home/nagios/.ssh/id_dsa.pub root@192.192.192.192:/root/.ssh/authorized_keys
root@192.192.192.192's password:
id_dsa.pub                                                                                                                  100%  602     0.6KB/s   00:00


Locked