I added three lines to my sudo configuration, using visudo.

User_Alias INSTALLERS = myusername

Cmnd_Alias INSTALL_CMDS = /bin/yum, /bin/make


After saving, if I run

sudo yum update

with myusername account, there are two problems:

1) I'm asked for my password

2) When I enter my password, I'm told "Sorry, user myusername is not allowed to execute '/usr/bin/yum update' as root"

Any idea why?

Thanks for your help.

  • 2
    The command has to match exactly /bin/yum != /usr/bin/yum/ – NickW May 15 '13 at 10:53
  • You're right. I though I had checked the path but I was wrong. Thanks!! – Benjamin Le Forestier May 15 '13 at 10:55
  • I always use which before adding a command to sudoers, lord knows I'm not immune to errors of that sort :) – NickW May 15 '13 at 10:56

Make sure the command you are authorizing in the sudoers file has the exact same path as found on the system. I often use which to double check before adding it to the file, just to be sure.

  • You're right. My mistake was that I indeed used which but I didn't realized I ran which on my local system, while I was using visudo on the remote server. The path for yum on fedora is /bin/yum while it's /usr/bin/yum on Centos. Thanks! – Benjamin Le Forestier May 15 '13 at 11:02

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.