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.
Permission Problem.
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Permission Problem.
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.
Re: Permission Problem.
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.
-
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Permission Problem.
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?"
Re: Permission Problem.
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.
Re: Permission Problem.
You may have to add a few lines to the /etc/sudoers file, such as:
Then, you should be able to restart the nagios service as nagios user.
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
...
Be sure to check out our Knowledgebase for helpful articles and solutions!