On a RHEL server I would like to let a user run a command as root without a password:
# uname -a
Linux foo.com 2.6.32-220.38.1.el6.x86_64 #1 SMP Wed May 15 08:34:56 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/issue
Red Hat Enterprise Linux Server release 6.5 (Santiago)
Kernel \r on an \m
# visudo
User_Alias FOOEMPLOYEES = someuser
Cmnd_Alias FOOCOMMANDS = /root/bin/fix-permissions
FOOEMPLOYEES ALL = NOPASSWD: FOOCOMMANDS
For some reason, the system is still asking the user for his password:
$ alias
alias fix-permissions='/root/bin/fix-permissions'
$ fix-permissions
-bash: /root/bin/fix-permissions: Permission denied
$ sudo fix-permissions
[sudo] password for someuser:
Why might the sudo
configuration not work? Did I configure it wrong? I copied the configuration from this guide.
/root/bin/fix-permissions
? And the last string shoul be ` FOOEMPLOYEES ALL = (ALL) NOPASSWD: FOOCOMMANDS` – Costas Oct 26 '14 at 10:14man sudoers
> The basic structure of a user specification is “who where = (as_whom) what” – Costas Oct 26 '14 at 10:28FOOEMPLOYEES ALL = (ALL) NOPASSWD: FOOCOMMANDS
. Running/root/bin/fix-permissions
still comments that permission is denied, but runningsudo /root/bin/fix-permissions
actually works. – dotancohen Oct 26 '14 at 11:08