Sudoers doesn't work with User_Alias as expected.

Solution Verified - Updated -

Issue

  • There is an user realuser and the alias for the same is USER_ALIAS_NEW.
  • The relevant part of file /etc/sudoers is as follows:
User_Alias  USER_ALIAS_NEW=realuser
root                ALL=(ALL)        ALL
Cmnd_Alias USER_CMDS =  cp /tmp/sc-USER_ALIAS_NEW/new.pem /etc/somelocation/;
USER_ALIAS_NEW ALL = (root) NOPASSWD: USER_CMDS
  • The command cp needs to run as root by user realuser.
  • The actual command it needs to run is cp /tmp/sc-realuser/new.pem /etc/somelocation/

Environment

  • Red Hat Enterprise Linux (RHEL) 5, 6
  • sudoers

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