3

Maybe my question is stupid but I'm really stuck...

My OS is Ubuntu 12.04
My sudoers:

#
# 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        mail_badpass
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
dart    ALL=(ALL) NOPASSWD: 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

Some console commands output:

$ id dart
uid=1000(dart) gid=1000(dart) groups=1000(dart),24(cdrom),30(dip),46(plugdev),107(lpadmin),124(sambashare)
$ sudo ls /root/
[sudo] password for dart: 

Why system asking password for sudo? How can I avoid it?

3 Answers 3

5

You're probably in the sudo or admin group, try putting the dart NOPASSWD: entry at the end of your sudoers file. Sudoers will match the last entry in the file which corresponds either to a user or a group, and as sudoers and admin come afterwards, and they ask for a password, so you're being prompted for a password.

1
  • No problem, nothing like experience to teach you something.. it has taught me plenty :)
    – NickW
    Feb 19, 2013 at 10:57
2

this is very simple

omid ALL=(ALL) NOPASSWD: ALL

put this command at end of file.(Important)

0

Here's mine and it works (don't ask me about details, though... I've had it for years on different machines and I simply copy and paste it). User needs to be in the "sudo" group.

#
# 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    mail_badpass
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:



# members of the sudo group don't have to enter the pass
%sudo ALL=NOPASSWD: ALL

#includedir /etc/sudoers.d

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .