Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer
    
YES! It was my problem) Thank you! –  dart Feb 19 '13 at 10:56
    
No problem, nothing like experience to teach you something.. it has taught me plenty :) –  NickW Feb 19 '13 at 10:57

this is very simple

omid ALL=(ALL) NOPASSWD: ALL

put this command at end of file.(Important)

share|improve this answer

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.