How to avoid sudo password prompt?

Question : How  to avoid sudo password prompt ?terminal

Answer  :


Assign the permissions to the sudoers file, by running the following command:

chmod 740 /etc/sudoers


Edit file  /etc/sudoes with  Vi or  gedit or  nano

nano  /etc/sudoers

and   replace

 %admin ALL=(ALL) ALL  



Save  and  exit


  • alexis

    what about using ‘visudo’ instead of changing file permissions ?

  • patrick

    visudo is working too

  • Jhon

    Bad, very bad idea do that.

  • greg

    this tutorial is for idiots.If u want windows with its lack of safety go and buy it!

  • ubuntufreak

    I don’t get that one…

  • http://enteryoursiteURL... Darko

    Using visudo is far more safe since it checks for syntax errors, and other stuff. If you want nano, use:

    EDITOR=nano visudo

    chmod-ing system security files is a bad practise, unless you really know what you’re doing. Let alone using sudo without a password. I guess to each his own…

  • Asterix1423

    If this article was meant to show that this is possible, than it’s ok.

    But it is such a very bad idea to do this! If done, you make your system almost as vulnarable for virusses and other shit as Windows is.

    So don’t. Please don’t. You now know that is’t possible, that should be enough.

  • threecheese

    1. The "safe" way to do this is to use the [code]visudo[/code] utility (if you mess up the sudoers file, you’re in big trouble).

    2. For your example, you also need to [code]usermod -a -G admin myusername[/code]

    3. Rather than making scary modifications to the %admin group, you should leave it alone and add a NOPASSWD line for your user (or group if it’s a multiuser box):
    %admin ALL=(ALL) ALL
    myusername ALL=NOPASSWD: ALL
    sudo usermod -a -G admin myusername
    This covers your user for both passwordless [code]sudo[/code]s, as well as sudoing to other, non-root users.


  • krasicki

    The chmod command hosed my system and made it impossible to correct.

  • Aldr01d

    is there a command for ubuntu 12.04 i tried this its not working!

  • Pirat9

    add this to sudoers files
    username  ALL=(ALL:ALL)  NOPASSWD: ALL
    %sudo   ALL=(ALL:ALL)  NOPASSWD: ALL

  • JT

    Why set permissions to 740? unless you’re owner of sudoers you’re locked out.