I've created a user noc and gave it a permission to run with sudo. I've added the following lines to the sudoers file.

Cmnd_Alias NOC = /etc/init.d/tomcat

Problem is that when I try run sudo /etc/init.d/tomcat status on machine A it says: "noc is not in the sudoers file. This incident will be reported"

but I run the same command with same configuration on machine B, it works fine.

things I've checked:

  • sudoers file permission is set to 0440
  • all lines in sudoers file on both machines are the exact same

I have CentOS 6.8 with latest updates installed.

  • I'm not sure if necessary, but did you log out then back in with noc? – Sparhawk Jul 5 '18 at 6:15
  • 1
    Related - askubuntu.com/questions/665950/…. – slm Jul 5 '18 at 6:21
  • 1
    have you run sudo -l as user noc, to make sure the sudo rule is truly there ? – steve Jul 5 '18 at 6:43
  • yes user is truely there – Ali Golestan Jul 5 '18 at 6:50
  • sdiff the 2 files b/w the 2 servers and double check that they're not different. – slm Jul 5 '18 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.