Page 1 of 1

nagios user and reconfigure_nagios.sh permissions

Posted: Wed Mar 26, 2014 3:41 pm
by kendallchenoweth
I know this can be done, because I've done it once and it didn't capture the commands to recreate it, so can you please help?

as the user nagios, on one server, I can run reconfigure_nagios.sh, but on another server it produces some of the errors shown below.

tar: usr/local/nagios/etc/hosts: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/hosts: Cannot change mode to rwsrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/pnp/pages: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/pnp/pages: Cannot change mode to rwxrwsr-x: Operation not permitted
tar: usr/local/nagios/etc/pnp/check_commands: Cannot utime: Operation not permitted
tar: usr/local/nagios/etc/pnp/check_commands: Cannot change mode to rwxrwsr-x: Operation not permitted

I think I ran a script that reset permissions and then maybe relaxed some of the permissions, but I don't remember. I assume it's OK to be able to run reconfigure_nagios.sh as nagios instead of root. (I know that if you run the command as both root and nagios, the temporary file ownership messes it all up, but if I always run the command line as nagios, I don't have this problem.)

Thanks!

Re: nagios user and reconfigure_nagios.sh permissions

Posted: Wed Mar 26, 2014 4:15 pm
by lmiltchev
What are the permissions on the nagios directory?

Code: Select all

ll -d usr/local/nagios
ll usr/local/nagios

Re: nagios user and reconfigure_nagios.sh permissions

Posted: Wed Mar 26, 2014 4:17 pm
by kendallchenoweth
[nagios@nagiosxinonprod-00-ah scripts]$ ll -d /usr/local/nagios
drwxr-xr-x 8 root root 4096 Jan 17 21:15 /usr/local/nagios

[nagios@nagiosxinonprod-00-ah scripts]$ ll /usr/local/nagios
total 24
drwxrwxr-x 2 nagios nagios 4096 Jan 17 21:16 bin
drwsrwsr-x 7 apache nagios 4096 Mar 26 20:33 etc
drwxrwxr-x 2 nagios nagios 4096 Jan 17 21:17 libexec
drwxrwxr-x 2 nagios nagios 4096 Jan 17 21:15 sbin
drwxrwxr-x 14 nagios nagios 4096 Jan 17 21:16 share
drwxrwxr-x 6 nagios nagios 4096 Mar 26 21:17 var

[nagios@nagiosxinonprod-00-ah scripts]$ ll /usr/local/nagios/etc/hosts
total 8
-rw-rw-r-- 1 apache nagios 1178 Mar 26 20:33 default_host_disabled.cfg
-rw-rw-r-- 1 apache nagios 746 Mar 11 15:58 localhost.cfg

Re: nagios user and reconfigure_nagios.sh permissions

Posted: Wed Mar 26, 2014 4:54 pm
by scottwilkerson
One more set of permissions

Code: Select all

ll -d /usr/local/nagios/etc/hosts /usr/local/nagios/etc/services /usr/local/nagios/etc/pnp

Re: nagios user and reconfigure_nagios.sh permissions

Posted: Thu Mar 27, 2014 8:46 am
by kendallchenoweth
[nagios@nagiosxinonprod-00-ah scripts]$ ll -d /usr/local/nagios/etc/hosts /usr/local/nagios/etc/services /usr/local/nagios/etc/pnp
drwsrwsr-x 2 apache nagios 4096 Mar 26 20:33 /usr/local/nagios/etc/hosts
drwxrwsr-x 4 apache nagios 4096 Mar 26 20:33 /usr/local/nagios/etc/pnp
drwsrwsr-x 2 apache nagios 4096 Mar 26 20:33 /usr/local/nagios/etc/services

Re: nagios user and reconfigure_nagios.sh permissions

Posted: Thu Mar 27, 2014 9:02 am
by scottwilkerson
This is really strange, is the nagios user account expired?

Code: Select all

chage -l nagios

Re: nagios user and reconfigure_nagios.sh permissions

Posted: Thu Mar 27, 2014 9:24 am
by kendallchenoweth
Last password change : Mar 11, 2014
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

Re: nagios user and reconfigure_nagios.sh permissions

Posted: Thu Mar 27, 2014 12:24 pm
by lmiltchev
If you haven't deleted the original install directory, cd into it and run "./upgrade":

Code: Select all

cd /tmp/nagiosxi
./upgrade
Make sure you don't have any config errors (you can apply configuration in the GUI).

Try again:

Code: Select all

su nagios
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh
Let me know if this fixed your issue.

Re: nagios user and reconfigure_nagios.sh permissions

Posted: Fri Mar 28, 2014 9:00 am
by kendallchenoweth
i found the problem. It was a bad object definition and once I removed it, everything worked fine.

You can mark this issue closed.

Thanks!