Results 1 to 4 of 4

Thread: /etc/sudoers No password

  1. #1
    Join Date
    Apr 2013
    Beans
    34

    /etc/sudoers No password

    How can I modify the /etc/sudoers file so that I don't have to type my password every time I run an sudo command? I tried to do this myself, but got the syntax wrong and this prevented all sudo commands (I booted into another OS and restored the old sudoers file). What's the correct way to do this?

    Also, how can I set a root password?

  2. #2
    Join Date
    Nov 2008
    Location
    Sheffield, UK
    Beans
    1,514
    Distro
    Ubuntu

    Re: /etc/sudoers No password

    Add

    USERNAME ALL=(ALL) NOPASSWD: ALL
    Code:
    #
    # This file MUST be edited with the 'visudo' command as root.
    #
    # Please consider adding local content in /etc/sudoers.d/ instead of
    # directly modifying this file.
    #
    # See the man page for details on how to write a sudoers file.
    #
    Defaults        env_reset
    Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    
    # Host alias specification
    
    # User alias specification
    
    # Cmnd alias specification
    
    # User privilege specification
    root    ALL=(ALL:ALL) ALL
    
    # Members of the admin group may gain root privileges
    %admin ALL=(ALL) ALL
    
    # Allow members of group sudo to execute any command
    %sudo   ALL=(ALL:ALL) ALL
    
    # See sudoers(5) for more information on "#include" directives:
    USERNAME ALL=(ALL) NOPASSWD: ALL

  3. #3
    Join Date
    Apr 2013
    Beans
    34

    Re: /etc/sudoers No password

    I added that line and immediately did a 'sudo ls' and it asked for my password.

    EDIT: Nevermind. Changed USERNAME to my username (duh!) and it worked. Thank you.

  4. #4
    Join Date
    Sep 2006
    Beans
    8,623
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: /etc/sudoers No password

    You can also use sudoers to set the timeout for a longer duration or even set it not to timeout:

    Code:
    Defaults  timestamp_timeout=-1

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
  •