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 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.