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

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
kaushalshriyan
Posts: 124
Joined: Fri May 22, 2015 7:12 am

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

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

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

Post 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)
Former Nagios Employee
kaushalshriyan
Posts: 124
Joined: Fri May 22, 2015 7:12 am

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

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

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

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
kaushalshriyan
Posts: 124
Joined: Fri May 22, 2015 7:12 am

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

Post 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]#
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

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

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked