nagios.cmd permission denied by root

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
liquidcool
Posts: 59
Joined: Tue Feb 21, 2012 6:08 am

nagios.cmd permission denied by root

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: nagios.cmd permission denied by root

Post by abrist »

The group memberships look fine. Did you restart snmptt after the group changes?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
liquidcool
Posts: 59
Joined: Tue Feb 21, 2012 6:08 am

Re: nagios.cmd permission denied by root

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: nagios.cmd permission denied by root

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
liquidcool
Posts: 59
Joined: Tue Feb 21, 2012 6:08 am

Re: nagios.cmd permission denied by root

Post by liquidcool »

will give it a go and get back to you
liquidcool
Posts: 59
Joined: Tue Feb 21, 2012 6:08 am

Re: nagios.cmd permission denied by root

Post 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.
Locked