Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Possible Duplicate:
How to run a specific program as root without a password prompt?

I installed fedora 15. I use sudo visudo to modify sudoers file and add the following line:


I then logout and login. I try doing any sudo command like sudo gvim &... but I am still getting prompted for password.

How do you get NOPASSWD sudo option to work in Fedora 15?

  • Is my syntax wrong?
  • Is there some Fedora 15 thing that is preventing this to work?


After seeing answers below talking about "the order of your sudoers file" I decided to copy the full sudoers file in here. I took the liberty of removing most white space lines, all comments lines, and all lines containing the string "Default":

root    ALL=(ALL)   ALL
USERNAME    ALL=NOPASSWD:ALL,/bin/mount,/bin/umount

%wheel  ALL=(ALL)   ALL
share|improve this question

marked as duplicate by Gilles, Michael Mrozek Sep 22 '11 at 3:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I am a little frustrated... because this is supposed to be soo simple. –  Trevor Boyd Smith Sep 15 '11 at 17:21
Could this be of help? linuxforums.org/forum/miscellaneous/… (look at the end for the solution) –  nico Sep 15 '11 at 17:34
wow nico. i went there. and you are correct. the problem was in the ordering of the statements in the sudoers file! If you had posted a full answer I would have given you the upvote/accepted answer. –  Trevor Boyd Smith Sep 15 '11 at 17:42
I did not know if that was actually the issue and I never used NOPASSWD before... so I just posted it as a comment. At the end, what's important is that you solved the problem :) –  nico Sep 15 '11 at 19:03
The problem is not related to sudo but to how does fedora intregrates sudo...which is with PAM. You may have the good config lines in the good order in your sudo config, it will not be sufficient on a fedora host: you will have to tune the PAM config for sudo by editing /etc/pam.d/su and add a line like "auth sufficient pam_admin.so trust use_uid" assuming you configured a NOPASSWD sudo config for group admin. –  Christophe Furmaniak Dec 4 at 13:34

1 Answer 1

up vote 6 down vote accepted

Often this is caused by the order of statements in /etc/sudoers, make sure that you have any permissions that may override it before you declare NOPASSWD, or it may be overridden by a later command.

Bear in mind that you should not be using sudo with gvim anyway -- graphical programs should be run with gksu, kdesu, or an alternative, otherwise you risk problems (particularly notable are problems with ~/.ICEauthority and other often-essential files).

share|improve this answer
FYI, if you read my post it says " I use sudo visudo to modify sudoers file". –  Trevor Boyd Smith Sep 15 '11 at 17:45
Chris and @nico, both of you are correct. The problem was in the ordering of the sudoers file. –  Trevor Boyd Smith Sep 15 '11 at 17:46
I don't understand, what relevance does using visudo have in the context of my answer? –  Chris Down Sep 15 '11 at 17:47
oh my bad. I had selective hearing... when I read your answer I thought it said 'you should not be editing the sudoers file with gvim'. When in reality you are saying "if you need to call a graphical program like gvim you can't use 'sudo'". –  Trevor Boyd Smith Sep 15 '11 at 17:51
ALL=(ALL) means the user may run as any user/group using sudo. My preferred way of doing it in your situation would be to do something like USER ALL = NOPASSWD: ALL, although I wouldn't recommend allowing a user to run anything elevated through sudo without a password (it seems like a significant security issue). –  Chris Down Sep 15 '11 at 18:20

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