i edited /etc/sudoers using visudo command so as to grant user sudo privilege without password as following :

userName ALL=(ALL:ALL) NOPASSWD:ALL

but it didn't work for me ,

any suggestions Thanks in advance

link|improve this question
1  
Did you use visudo to edit the file. Are you sure your config is valid? – Zoredache Dec 19 '11 at 2:37
1  
What does the output of sudo -l look like while logged in as userName? – Kyle Smith Dec 19 '11 at 3:49
@Zoredache i used visudo , what do you mean with valid config ? – Eslam Dec 20 '11 at 0:41
@KyleSmith :Matching Defaults entries for emamdouh on this host: env_reset User emamdouh may run the following commands on this host: (ALL : ALL) NOPASSWD: ALL (ALL) ALL – Eslam Dec 20 '11 at 0:43
feedback

migrated from stackoverflow.com Dec 18 '11 at 23:46

This question came from our site for professional and enthusiast programmers.

closed as off topic by SvenW, Shane Madden, Bart De Vos, Ward, MDMarra Dec 19 '11 at 20:05

Questions on Server Fault are expected to generally relate to servers, networking, or desktop infrastructure, within the scope defined in the faq.

2 Answers

up vote 8 down vote accepted

Make sure that no rule below your mentioned rule are overriding it. From man sudoers (1.7.2p2):

   When multiple entries match for a user, they are applied in order.
   Where there are multiple matches, the last match is used (which is not
   necessarily the most specific match).
link|improve this answer
you are right as output of sudo -l shows that there are two rules applied to that user – Eslam Dec 20 '11 at 0:45
feedback

try

userName ALL = NOPASSWD: ALL
link|improve this answer
Please expand on your answer (why should they try this? what does it do?) -- See blog.serverfault.com/2011/06/09/press-the-green-button-twice – voretaq7 Dec 19 '11 at 3:25
nope, this wasn't the problem, the problem was that there was two rules applied to that user – Eslam Dec 20 '11 at 0:46
feedback

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