Page 1 of 1

nagios.cmd permission denied by root

Posted: Tue Oct 07, 2014 5:19 am
by liquidcool
Hi,

I have a slight issue where I am running snmptt and when it processes an snmp trap it writes to the nagios.cmd file, but for some reason it is getting a permission denied even though it is running as root.

The permissions on the directory are :
drwxrwsr-x 2 nagios nagcmd 4096 2014-10-07 11:12 rw

and on the file :
prw-rw---- 1 nagios nagcmd 0 2014-10-07 10:43 nagios.cmd

the groups are :
nagios:!:20001:wwwrun,nagios
nagcmd:!:20002:wwwrun,nagios,root,snmptt,nobody

how do I get nagios (on a restart) to create the nagios.cmd file with 666 permissions

I tried the umask line in the .bashrc for the nagios user, but that did not seem to do it.

Thanks in advance

Re: nagios.cmd permission denied by root

Posted: Tue Oct 07, 2014 4:55 pm
by abrist
The group memberships look fine. Did you restart snmptt after the group changes?

Re: nagios.cmd permission denied by root

Posted: Wed Oct 08, 2014 3:30 am
by liquidcool
Yes I did ...

And in the log files the script was failing with a permission denied for root.

I have had to put a sleep statement in the init script and thereafter I also put a chmod 666 for that file, but that just seems like a work around. Would have thought nagios daemon could create the file with a 666 default.

Re: nagios.cmd permission denied by root

Posted: Thu Oct 09, 2014 2:33 pm
by lmiltchev
Have you tried adding the "snmptt" to the "nagios" group as well? On my test box I have:

Code: Select all

grep nag /etc/group
nagios:x:500:nagios,apache,snmptt
nagcmd:x:501:nagios,apache,snmptt

Re: nagios.cmd permission denied by root

Posted: Fri Oct 10, 2014 4:25 am
by liquidcool
will give it a go and get back to you

Re: nagios.cmd permission denied by root

Posted: Fri Oct 10, 2014 5:52 am
by liquidcool
Ok, it is working now ... I did not restart the snmptt process after adding it to the nagcmd group .... thought I did ... but clearly I didn't

Thanks for your help.