Page 1 of 1

nagiosql.delete.service: Permission denied

Posted: Mon Apr 14, 2014 6:06 pm
by nytstevenlu
Hi,

I have a local script on our Nagios XI server to delete decommissioned services/hosts automatically. The script calls /usr/local/nagiosxi/scripts/nagiosql_delete_service.php and /usr/local/nagiosxi/scripts/nagiosql_delete_host.php. It works well when I run it as root, however it gives me the following errors when I run it as user 'nagios':
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosql/admin/services.php --no-check-certificate --post-data 'chbId_299=on&selModify=delete&hidModify&modus=checkform' -O nagiosql.delete.service
nagiosql.delete.service: Permission denied
I need to call these nagiosql scripts as user 'nagios' for multiple reasons (e.g. security), so is there a way to allow that?

Thanks,
Steven

Re: nagiosql.delete.service: Permission denied

Posted: Tue Apr 15, 2014 9:18 am
by scottwilkerson
Normally these should be owned by the nagios user. Lets run

Code: Select all

chown nagios:nagios /usr/local/nagiosxi/scripts/nagiosql.*

Re: nagiosql.delete.service: Permission denied

Posted: Tue Apr 15, 2014 9:47 am
by nytstevenlu
Yep, that resolved the issue. Not sure why those files were owned by root in the first place..

Thanks a lot!

Re: nagiosql.delete.service: Permission denied

Posted: Tue Apr 15, 2014 9:48 am
by tmcdonald
nytstevenlu wrote:Yep, that resolved the issue. Not sure why those files were owned by root in the first place..

Thanks a lot!
Great! Nice to see a quick fix. I'll be closing this thread now, but feel free to open another if you need anything in the future!