Results 1 to 4 of 4

Thread: NOPASSWD doesn't apply in sudoers

  1. #1
    Join Date
    Jun 2010
    Beans
    2

    NOPASSWD doesn't apply in sudoers

    Hi,

    I'be this weird problem with sudo. I can't make the NOPASSWD option to work propertly.
    I've tried both:
    Code:
    simon    ALL=NOPASSWD:/usr/bin/whoami
    and
    Code:
    simon   ALL=(root)  NOPASSWD:/usr/bin/whoami
    I've few machines that run RH with the exactly same row without any problem. I've searched the doc's and google and couldn't find similar problem. (I've found this topic and in order to eliminate script problem, I tried with whoami)


    Code:
    simon@abc:~/SYNC$   sudo cat /etc/sudoers
    [sudo] password for simon:
    # /etc/sudoers
    #
    #  This file MUST be edited with the 'visudo' command as root.
    #
    #  See the man page for details on how to write a sudoers file.
    #
    
    Defaults          env_reset
    
    # Host alias specification
    
    # User alias  specification
    
    # Cmnd alias specification
    
    # User privilege  specification
    root    ALL=(ALL) ALL
    simon    ALL=NOPASSWD:/usr/bin/whoami
    # Uncomment to allow members of group  sudo to not need a password
    # (Note that later entries override this,  so you might need to move
    # it further down)
    # %sudo  ALL=NOPASSWD: ALL
    
    # Members of the admin group may gain root  privileges
    %admin ALL=(ALL) ALL
    simon@abc:~/SYNC$ sudo -k
    simon@abc:~/SYNC$   sudo /usr/bin/whoami
    [sudo] password for simon:
    simon@abc:~/SYNC$
    (BTW, I edit the sudoers file with visudo of course)
    Last edited by TheSimon; June 9th, 2010 at 11:22 AM.

  2. #2
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: NOPASSWD doesn't apply in sudoers

    Hi and welcome to the forums!

    You have to add the line after the %admin ... line:
    Code:
    # /etc/sudoers
    #
    #  This file MUST be edited with the 'visudo' command as root.
    #
    #  See the man page for details on how to write a sudoers file.
    #
    
    Defaults          env_reset
    
    # Host alias specification
    
    # User alias  specification
    
    # Cmnd alias specification
    
    # User privilege  specification
    root    ALL=(ALL) ALL
    
    # Uncomment to allow members of group  sudo to not need a password
    # (Note that later entries override this,  so you might need to move
    # it further down)
    # %sudo  ALL=NOPASSWD: ALL
    
    # Members of the admin group may gain root  privileges
    %admin ALL=(ALL) ALL
    
    simon    ALL=NOPASSWD:/usr/bin/whoami
    Sudo reads the sudoers file and applies permissions in order from top to bottom. So the last line in the file will overwrite any previous conflict with the config settings. So it is best to put new configuration lines at the bottom.


    HowTO: Sudoers Configuration

  3. #3
    Join Date
    Jun 2010
    Beans
    2

    Re: NOPASSWD doesn't apply in sudoers

    Gr8! That worked like a magic. I knew it is something obvious.

    Now some forum support question How do I mark this as solved?

  4. #4
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: NOPASSWD doesn't apply in sudoers

    Quote Originally Posted by TheSimon View Post
    Gr8! That worked like a magic. I knew it is something obvious.

    Now some forum support question How do I mark this as solved?
    At the top of the page, click the "Thread Tools" Menu and then "Mark this thread as Solved".

    For a screenshot see the link from my signature.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •