Page 1 of 1

rerun chown nagios:nagcmd /usr/local/nagios/var/rw command

Posted: Tue Aug 16, 2016 9:05 am
by kaushalshriyan
Hi,

I have to rerun the below chown command every time whenever i have to restart the nagios service

chown nagios:nagcmd /usr/local/nagios/var/rw
chown nagios:nagcmd /usr/local/nagios/var/rw/nagios.cmd


/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
systemctl restart nagios.service
cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

Nagios Core 4.2.0
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-01-2016
License: GPL

Any help will be highly appreciable.

Regards,

Kaushal

Re: rerun chown nagios:nagcmd /usr/local/nagios/var/rw comma

Posted: Tue Aug 16, 2016 11:27 am
by rkennedy
Can you post the instructions you used when initially installing? It looks like the variables for permissions are getting set on start.

What are they getting set to after you start the service? (before running the chown)

Re: rerun chown nagios:nagcmd /usr/local/nagios/var/rw comma

Posted: Tue Aug 16, 2016 1:04 pm
by kaushalshriyan
Hi Robert,

cat /etc/init.d/nagios -> http://sprunge.us/dJSU. I am following http://tecadmin.net/install-nagios-core ... ntos-rhel/. Please correct me if i am doing wrong.

Regards,

Kaushal

Re: rerun chown nagios:nagcmd /usr/local/nagios/var/rw comma

Posted: Tue Aug 16, 2016 5:05 pm
by tgriep
If you do restart the nagios daemon, what do the permissions change to?
Can you run the following and post the output?

Code: Select all

chage -l nagios
grep nag /etc/passwd
grep nag /etc/group

Re: rerun chown nagios:nagcmd /usr/local/nagios/var/rw comma

Posted: Tue Aug 16, 2016 5:07 pm
by scottwilkerson
Also, can you show us the results of

Code: Select all

ls -ld /usr/local/nagios/var/rw
We want to make sure you have the group sticky bit on the directory and the group should be nagios

Code: Select all

drwxrwsr-x 2 nagios nagios 4096 Aug 16 05:59 /usr/local/nagios/var/rw
Additionally your nagios user should be a member of the nagios and nagcmd group

Code: Select all

# cat /etc/group|grep nag
nagios:x:500:nagios,apache
nagcmd:x:501:nagios,apache

Re: rerun chown nagios:nagcmd /usr/local/nagios/var/rw comma

Posted: Tue Aug 16, 2016 9:51 pm
by kaushalshriyan
[root@e2e-13-130 nagios]# ls -ld /usr/local/nagios/var/rw
drwxrwsr-x. 2 nagios nagios 4096 Aug 17 08:04 /usr/local/nagios/var/rw
[root@e2e-13-130 nagios]# chage -l nagios
Last password change : Aug 03, 2016
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 99999
Number of days of warning before password expires : 7
[root@e2e-13-130 nagios]# grep nag /etc/passwd
systemd-network:x:997:996:systemd Network Management:/:/sbin/nologin
nagios:x:1000:1000::/home/nagios:/bin/bash
[root@e2e-13-130 nagios]# grep nag /etc/group
nagios:x:1000:nagios,apache
nagcmd:x:1001:apache,nagios
[root@e2e-13-130 nagios]# cat /etc/group|grep nag
nagios:x:1000:nagios,apache
nagcmd:x:1001:apache,nagios
[root@e2e-13-130 nagios]#

Re: rerun chown nagios:nagcmd /usr/local/nagios/var/rw comma

Posted: Wed Aug 17, 2016 2:10 pm
by tgriep
When you compiled Core, did you run the configure command like below?

Code: Select all

./configure --with-command-group=nagcmd
Try and recompiling Core by following this guide and see if that fixes the issue.
https://assets.nagios.com/downloads/nag ... Source.pdf

Is selinux enabled on your server? Run the following command and post the output to see if it is enabled.

Code: Select all

getenforce