Permission Problem.

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
veenm
Posts: 148
Joined: Tue Jun 18, 2013 5:58 am

Permission Problem.

Post by veenm »

I have installed the nagios core 3.5.1 version on RHEL system using root as a user. Now i want to restart the nagios service as nagios user . When i do that it is giving below error. It is prompting for a password. How can i resolve this. I dont have a root access to on the nagios server now and have to use "nagios" user. Please let me know how we can resolve this.

[nagios@CNPUDAS011 objects]$ service nagios restart
Running configuration check...done.
Stopping nagios: .done.
rm: cannot remove `/var/lock/subsys/nagios': Permission denied
Starting nagios:Password:
touch: cannot touch `/var/lock/subsys/nagios': Permission denied
done.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Permission Problem.

Post by sreinhardt »

What permissions are on that file?

Code: Select all

ls -la /var/lock/subsys/nagios
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
veenm
Posts: 148
Joined: Tue Jun 18, 2013 5:58 am

Re: Permission Problem.

Post by veenm »

Is that possible to manage the nagios core using "nagios" as a normal user. Because i have done the whole nagios implementation using "root" . now i dont have a root access to nagios . Now i am logging as a "nagios" user . But when i restart the nagios service it is asking for the password and showing below error.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Permission Problem.

Post by slansing »

Well you should be able to set up and configure nagios just fine with root, I'm not sure what you did to remove access from it?? What error are you getting, can you "su to root?"
veenm
Posts: 148
Joined: Tue Jun 18, 2013 5:58 am

Re: Permission Problem.

Post by veenm »

i have not removed the root access . I dont want to restart the nagios service by logging as root user. when i log in as "nagios " user and try to restart the service i am getting the error. please let me know is that possible to restart the nagios service using nagios user . please confirm whether we need root access to restart the nagios service.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Permission Problem.

Post by lmiltchev »

You may have to add a few lines to the /etc/sudoers file, such as:

Code: Select all

nagios ALL = NOPASSWD:/etc/init.d/nagios start
nagios ALL = NOPASSWD:/etc/init.d/nagios stop
nagios ALL = NOPASSWD:/etc/init.d/nagios restart
nagios ALL = NOPASSWD:/etc/init.d/nagios reload
...
Then, you should be able to restart the nagios service as nagios user.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked