enable NOPASSWD for yourself

I have some bash scripts which I manually run a lot and they need to run with sudo. I also don’t want to be prompted for any password. Here is the solution.

  1. Edit the /etc/sudoers:

    [code language=”bash”]$ sudo vi /etc/sudoers[/code]

  2. Add a new entry at the last (USERNAME is your account name).

    [code language=”text” firstline=”18″ highlight=”26″]
    # 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:

    #includedir /etc/sudoers.d

  3. Restart the sudo service.

    [code language=”bash”]$ sudo service sudo restart[/code]

  4. Logout then login again. You won’t be prompted for the password anymore.