Page 3 of 4

Re: Remote command execution failed: Permission denied,pleas

Posted: Thu Jun 12, 2014 7:37 am
by rajesh.mehra
Post output here of error when su - nagios

Re: Remote command execution failed: Permission denied,pleas

Posted: Thu Jun 12, 2014 7:39 am
by rajesh.mehra
:D Your problem is going to solve in coming posts

Re: Remote command execution failed: Permission denied,pleas

Posted: Thu Jun 12, 2014 7:44 am
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?

Re: Remote command execution failed: Permission denied,pleas

Posted: Thu Jun 12, 2014 7:49 am
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

Re: Remote command execution failed: Permission denied,pleas

Posted: Thu Jun 12, 2014 7:57 am
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?

Re: Remote command execution failed: Permission denied,pleas

Posted: Thu Jun 12, 2014 8:00 am
by rajesh.mehra
try this command

Code: Select all

su - nagios -s /bin/bash

Re: Remote command execution failed: Permission denied,pleas

Posted: Thu Jun 12, 2014 8:03 am
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

Re: Remote command execution failed: Permission denied,pleas

Posted: Thu Jun 12, 2014 8:04 am
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 

Re: Remote command execution failed: Permission denied,pleas

Posted: Thu Jun 12, 2014 8:12 am
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
[email protected]'s password: 
NAGIOS OK: 41 processes, status log updated 200 seconds ago
nagios@maestro:~$ 
it will ask password
yes! :) and then! :)

Re: Remote command execution failed: Permission denied,pleas

Posted: Thu Jun 12, 2014 8:14 am
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 [email protected]:/root/.ssh/authorized_keys
[email protected]'s password:
id_dsa.pub                                                                                                                  100%  602     0.6KB/s   00:00