Google Plus

How to avoid sudo password prompt?

Written by Mel Kham on . Posted in linux command

Question : How  to avoid sudo password prompt ?terminal

Answer  :

First

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

chmod 740 /etc/sudoers

Second:

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

nano  /etc/sudoers

and   replace

 %admin ALL=(ALL) ALL  

  with

%admin ALL=(ALL) NOPASSWD: ALL

Save  and  exit

Enjoy

For questions please refer to our Q/A forum at : http://ask.unixmen.com

Mel Kham

Founder of Unixmen, Living in Amsterdam. Am working in my free time to help people to understand the Opensource and to explain them in easy way how to make the fist steps to the the light. Working day and night with my Co-founder Zinovsky to keep this website live even with less resources.
  • 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!

  • http://ubuntufreak.blog.com 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):
    [code]
    %admin ALL=(ALL) ALL
    myusername ALL=NOPASSWD: ALL
    [/code]
    [code]
    sudo usermod -a -G admin myusername
    [/code]
    This covers your user for both passwordless [code]sudo[/code]s, as well as sudoing to other, non-root users.

    HTH

  • http://serioussoftware.blogspot.com 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.

Like us on Facebook

This week Top Posts

Write for us

Recent Comments

abhishek Bagusetty

|

Hey Mel,

First of all, its good that you have figured a way to block torrents using iptables. I am new to networking and would like to do couple of things.

1) Monitor the network activity in the home network

2) Block all the torrents from downloading.

Is there a tool or a way in linux which could give me some solutions to meet the above mentioned cases. I dont want to use any commercial programs as I am more towards OpenSource. It would be greatful if you could offer me some help.

Thanks,

Abhi

Abhishek

Department of Chemical Engineering

The University of Utah

Ernesto Gutierrez

|

Mel, I’ve been unsuccessful at installing citrix receiver on a 64 bit fedora install.
Eventhough I am following your instructions to the T.

Can you provide guidance via email?

SK

|

Yes you can. It should work.

LinuxSytesNet

|

Yesterday watched a movie with Morgan Freeman called ‘ A long came a spider ‘ and must say that I was quite impressed how they exchanged encrypted messages hidden in pictures. Thank you for the tutorial :)

 
IDG Tech Network
Copyright © 2008-2013 Unixmen.com .
Maintained by Anblik .