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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content