Permissin denied commands.cfg

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.
mfrycke
Posts: 29
Joined: Wed Mar 22, 2017 9:40 am

Permissin denied commands.cfg

Post by mfrycke »

Hi.
First i get a problem with the boot disk on my unbunyu server get full. i install unbuntu tweak and remove old image files. After that i boot the servern and get som problems with permission to a lot of map/files.
I have try to change it with chmod 666/777.
finally i get nagios up and i looks find. Then i went in to the contacts.cfg files and change a mailadress an think thats everything i ok but..

now when i thy to start nagios :
ebsite: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Cannot open config file '/usr/local/nagios/etc/objects/commands.cfg' for reading: Permission denied
Error processing object config files!


***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.


when i take ls -l

oot@ubusrv:/usr/local/nagios/etc# ls -l
total 84
-rwxrwxrwx 1 nagios nagios 12267 Mar 30 2016 cgi.cfg
-rwxrwxrwx 1 nagios nagios 104 Mar 31 2016 commands.cfg
-rwxrwxrwx 1 root root 50 Mar 30 2016 htpasswd.users
-rwxrwxrwx 1 nagios nagios 44830 Mar 22 14:51 nagios.cfg
-rwxrwxrwx 1 nagios nagios 7988 Mar 30 2016 nrpe.cfg
drw-rw-rw- 2 nagios nagios 4096 Mar 22 10:32 objects
-rwxrwxrwx 1 nagios nagios 1312 Mar 30 2016 resource.cfg
drw-rw-rw- 2 root root 4096 Oct 10 14:27 servers

i have try to start up nagios from nagios user and root and the same problem come up.

Please i need som help.. :shock:
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Permissin denied commands.cfg

Post by cdienger »

Greetings,

It looks like you may have gone a little overboard granting permissions while troubleshooting this. Typical permissions on files in the /usr/local/nagios/etc/ directory look like:

drwxrwxr-x 3 nagios nagios 4.0K Mar 20 10:43 .
drwxr-xr-x 9 root root 87 Mar 3 12:34 ..
-rw-rw-r-- 1 nagios nagios 13K Mar 14 10:28 cgi.cfg
-rw-rw-r-- 1 nagios nagios 12K Mar 3 12:31 cgi.cfg~
-rw-r--r-- 1 root root 50 Mar 3 12:33 htpasswd.users
-rw-rw-r-- 1 nagios nagios 45K Mar 16 10:27 nagios.cfg
-rw-rw-r-- 1 nagios nagios 44K Mar 9 15:53 nagios.cfg~
-rw-r--r-- 1 root root 5.2K Mar 15 16:52 ndo2db.cfg
-rw-r--r-- 1 root root 5.0K Mar 15 16:18 ndomod.cfg
drwxrwxr-x 2 nagios nagios 4.0K Mar 17 13:40 objects
-rw-rw---- 1 nagios nagios 1.3K Mar 9 16:27 resource.cfg
-rw-rw---- 1 nagios nagios 1.3K Mar 3 12:31 resource.cfg~

That said, the error you are getting is complaining about /usr/local/nagios/etc/objects/commands.cfg. Please check the permissions of this file by running "ls -l /usr/local/nagios/etc/objects/"
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mfrycke
Posts: 29
Joined: Wed Mar 22, 2017 9:40 am

Re: Permissin denied commands.cfg

Post by mfrycke »

but it is a problem tha i have give to much rights?

-rwxrwxrwx 1 nagios nagios 104 Mar 31 2016 commands.cfg
mfrycke
Posts: 29
Joined: Wed Mar 22, 2017 9:40 am

Re: Permissin denied commands.cfg

Post by mfrycke »

i have change it to -rw-rw-rw- 1 nagios nagios 7819 Apr 20 2016 commands.cfg

try to start i again but
Running configuration check...

Nagios Core 4.2.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-07-2016
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Cannot open config file '/usr/local/nagios/etc/objects/commands.cfg' for reading: Permission denied
Error processing object config files!


***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
mfrycke
Posts: 29
Joined: Wed Mar 22, 2017 9:40 am

Re: Permissin denied commands.cfg

Post by mfrycke »

maybe this is a clue. when i try to open this folder with the nagios user

cd /usr/local/nagios/etc/objects
-su: cd: /usr/local/nagios/etc/objects: Permission denied


when i try it with the root user its work
ls -l objects
drw-rw-rw- 2 nagios nagios 4096 Mar 22 17:37 objects
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Permissin denied commands.cfg

Post by cdienger »

Please provide the output of 'ls -l /usr/local/nagios/etc/objects' as well as a copy of /var/log/messages and /usr/local/nagios/var/nagios.log.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mfrycke
Posts: 29
Joined: Wed Mar 22, 2017 9:40 am

Re: Permissin denied commands.cfg

Post by mfrycke »

root@ubusrv:/usr/local/nagios/etc/objects# ls -l
total 96
-rw-rw-rw- 1 nagios nagios 7819 Apr 20 2016 commands.cfg
-rw-rw-rw- 1 nagios nagios 2909 Mar 22 12:50 contacts.cfg
-rw-rw-rw- 1 nagios nagios 5381 Apr 21 2016 localhost.cfg
-rw-rw-r-- 1 nagios nagios 3096 Mar 30 2016 printer.cfg
-rw-rw-rw- 1 nagios nagios 3265 Mar 30 2016 switch.cfg
-rw-rw-r-- 1 nagios nagios 10621 Mar 30 2016 templates.cfg
-rw-rw-rw- 1 nagios nagios 3180 Apr 20 2016 timeperiods.cfg
-rwxrwxrwx 1 nagios nagios 49853 Mar 22 10:32 windows.cfg

/var/nagios.log
this log is really big
iam not sure what i should copy
this is the end

490185652] Warning: Return code of 13 for check of service 'C:\ Drive Space' on host 'SBDC02' was out of bounds.
[1490185652] SERVICE ALERT: SBDC02;C:\ Drive Space;CRITICAL;SOFT;2;(Return code of 13 is out of bounds)
[1490185652] Warning: Return code of 13 for check of host 'TICSRV' was out of bounds.
[1490185652] HOST ALERT: TICSRV;DOWN;SOFT;7;(Return code of 13 is out of bounds)
[1490185652] Warning: Return code of 13 for check of host 'SBDC02' was out of bounds.
[1490185653] Warning: Return code of 13 for check of service 'NSClient++ Version' on host 'HOMSRV13' was out of bounds.
[1490185653] SERVICE ALERT: HOMSRV13;NSClient++ Version;CRITICAL;HARD;3;(Return code of 13 is out of bounds)
[1490185653] Warning: Return code of 13 for check of host 'HOMSRV13' was out of bounds.
[1490185653] HOST ALERT: HOMSRV13;DOWN;HARD;10;(Return code of 13 is out of bounds)
[1490185653] HOST NOTIFICATION: nagiosadmin;HOMSRV13;DOWN;notify-host-by-email;(Return code of 13 is out of bounds)
[1490185654] Warning: Return code of 13 for check of host 'BRECCE' was out of bounds.
[1490185654] HOST ALERT: BRECCE;DOWN;SOFT;8;(Return code of 13 is out of bounds)
[1490185655] Error: Unable to create temp file '/usr/local/nagios/var/nagios.tmp0Ns7af' for writing status data: Permission denied
[1490185655] Error: Could not open check result queue directory '/usr/local/nagios/var/spool/checkresults' for reading.
[1490185656] Warning: Return code of 13 for check of service 'Uptime' on host 'TICSRV' was out of bounds.
[1490185656] SERVICE ALERT: TICSRV;Uptime;CRITICAL;HARD;3;(Return code of 13 is out of bounds)
[1490185656] Warning: Return code of 13 for check of service 'Uptime' on host 'SBDC02' was out of bounds.
[1490185656] SERVICE ALERT: SBDC02;Uptime;CRITICAL;SOFT;2;(Return code of 13 is out of bounds)
[1490185658] Warning: Return code of 13 for check of service 'C:\ Drive Space' on host 'LCMSRV10' was out of bounds.
[1490185658] SERVICE ALERT: LCMSRV10;C:\ Drive Space;CRITICAL;HARD;3;(Return code of 13 is out of bounds)
[1490185658] Warning: Return code of 13 for check of host 'LCMSRV10' was out of bounds.
[1490185659] Warning: Return code of 13 for check of service 'NSClient++ Version' on host 'VIOSRV' was out of bounds.


[1490185660] Warning: Return code of 13 for check of host 'FSSRS' was out of bounds.
[1490185660] HOST ALERT: FSSRS;DOWN;SOFT;9;(Return code of 13 is out of bounds)
[1490185661] Warning: Return code of 13 for check of service 'CPU Load' on host 'CORSRV' was out of bounds.
[1490185661] SERVICE ALERT: CORSRV;CPU Load;CRITICAL;HARD;3;(Return code of 13 is out of bounds)
[1490185661] Caught SIGTERM, shutting down...
[1490185661] Caught SIGTERM, shutting down...
[1490185661] Successfully shutdown... (PID=1305)
[1490185661] Event broker module 'NERD' deinitialized successfully.
[1490201755] Nagios 4.2.4 starting... (PID=11775)
[1490201755] Local time is Wed Mar 22 17:55:55 CET 2017
[1490201755] LOG VERSION: 2.0
[1490201755] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1490201755] qh: core query handler registered
[1490201755] nerd: Channel hostchecks registered successfully
[1490201755] nerd: Channel servicechecks registered successfully
[1490201755] nerd: Channel opathchecks registered successfully
[1490201755] nerd: Fully initialized and ready to rock!
[1490201755] wproc: Successfully registered manager as @wproc with query handler
[1490201755] wproc: Registry request: name=Core Worker 11776;pid=11776
[1490201755] wproc: Registry request: name=Core Worker 11777;pid=11777
[1490201755] wproc: Registry request: name=Core Worker 11780;pid=11780
[1490201755] wproc: Registry request: name=Core Worker 11778;pid=11778
[1490201755] wproc: Registry request: name=Core Worker 11779;pid=11779
[1490201755] wproc: Registry request: name=Core Worker 11781;pid=11781
[1490201755] Error: Cannot open config file '/usr/local/nagios/etc/objects/commands.cfg' for reading: Permission denied
[1490201755] Bailing out due to one or more errors encountered in the configuration files. Run Nagios from the command line with the -v option to verify your config before restarting. (PID=11775)
[1490201755] Event broker module 'NERD' deinitialized successfully



cant find var/message

root@ubusrv:/var/log# ls
alternatives.log boot.log dpkg.log.4.gz mail.err.1 syslog.6.gz
alternatives.log.1 bootstrap.log dpkg.log.5.gz mail.err.2.gz syslog.7.gz
alternatives.log.2.gz btmp dpkg.log.6.gz mail.err.3.gz teamviewer11
alternatives.log.3.gz btmp.1 dpkg.log.7.gz mail.err.4.gz udev
alternatives.log.4.gz cups faillog mail.log unattended-upgrades
alternatives.log.5.gz dist-upgrade fontconfig.log mail.log.1 upstart
alternatives.log.6.gz dmesg fsck mail.log.2.gz wtmp
apache2 dmesg.0 gdm mail.log.3.gz wtmp.1
apport.log dmesg.1.gz installer mail.log.4.gz Xorg.0.log
apport.log.1 dmesg.2.gz kern.log pbis-open-install.log Xorg.0.log.old
apport.log.2.gz dmesg.3.gz kern.log.1 samba Xorg.1.log
apt dmesg.4.gz kern.log.2.gz syslog Xorg.1.log.old
auth.log domainjoin-cli.log kern.log.3.gz syslog.1 Xorg.2.log
auth.log.1 dpkg.log kern.log.4.gz syslog.2.gz
auth.log.2.gz dpkg.log.1 landscape syslog.3.gz
auth.log.3.gz dpkg.log.2.gz lastlog syslog.4.gz
auth.log.4.gz dpkg.log.3.gz mail.err syslog.5.gz
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Permissin denied commands.cfg

Post by cdienger »

Were any changes made to the nagios.cfg file? The permissions look good so I wonder if maybe it's pointing to a different file. Please provide a copy of the /usr/local/nagios/etc/nagios.cfg file so we can confirm.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
mfrycke
Posts: 29
Joined: Wed Mar 22, 2017 9:40 am

Re: Permissin denied commands.cfg

Post by mfrycke »

how do i copy all text in that file?
mfrycke
Posts: 29
Joined: Wed Mar 22, 2017 9:40 am

Re: Permissin denied commands.cfg

Post by mfrycke »

this was # out becouse checkresults wasent found in spool
445 # CHECK RESULT PATH

452 #check_result_path=/usr/local/nagios/var/spool/checkresults
Last edited by mfrycke on Wed Mar 22, 2017 4:03 pm, edited 1 time in total.
Locked