root sudo fails with the error : "root is not in the sudoers file. This incident will be reported"

Solution Verified - Updated -

Issue

Following command was executed as root and it failed with an error :

[root@host]sudo -u test vi /var/log/messages
root is not in the sudoers file.  This incident will be reported.

Running the same command as a normal user was successful.

[anotheruser@host]sudo -u test vi /var/log/messages

Environment

  • Red Hat Enterprise Linux 4,5,6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.