I want to run any program without asking root password. Because I'm the only person who use the system. So I googled and edited /etc/sudoers.

What I did:

# chmod 640 /etc/sudoers
# vim /etc/sudoers

Added a line like below:

# User privilege specification
root    ALL=(ALL:ALL) ALL

saved and closed the file. Rebooted system. But no change/improvement. Am I want to change any other lines? or Is there any way?


1.I changed permissions /etc/sudoers to 0440. ls -l /etc/sudoers result is

-r--r----- 1 root root 772 May  4 19:43 /etc/sudoers

2.I run # visudo. File content is

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

But still it asking for password when I run sudo ls.

System Info: Ubuntu 14.04 x86_64 3.13.0-24-generic

  • 3
    do not vim /etc/sudoers, use visudo
    – guido
    May 4, 2014 at 10:09
  • 2
    also, I think you tinkering with sudoers file persmissions could be cause of errors, put it back to 0440
    – guido
    May 4, 2014 at 10:12

2 Answers 2


First some general points:

  1. Never edit /etc/sudoers directly. You should always use sudo visudo instead which allows you to edit the file but checks it for errors before saving. The syntax of sudoers is tricky and a mistake can render your system unusable since you will not longer be able to use sudo.

  2. Never change the permissions of /etc/sudoers. In general, you shouldn't change the permissions of system files. In many cases, the programs associated with them will not work properly and it is bad practice and a security hole. That's what sudo is for in the first place, so you don't need to change the permissions.

    In addition, if you have set the permissions of /etc/sudoers to 640 and were able to write to it, that means you have also changed its owner to your user. That will effectively break it. As explained in man sudoers:

    /etc/sudoers is owned by gid N, should be 1 The sudoers file has the wrong group ownership. If you wish to change the sudoers file group ownership, please add “sudoers_gid=N” (where ‘N’ is the group ID that owns the sudoers file) to the sudoers Plugin line in the sudo.conf(5) file.

  3. If you want regular users to be able to mount a drive, a better way is to specify that in /etc/fstab. Using your example, you would want this line there:

    /dev/sda6   /media/sgg/D    vfat    users,rw,errors=remount-ro,noauto  0   0

    That will allow regular users to mount it with

    mount /dev/sda6
  4. If despite the above, you still want to allow your user to run any command without a password, the line you want to add to /etc/sudoers (using sudo visudo) is:


    Save the file and exit visudo and try running sudo ls, you shouldn't be asked for a password. I just tested and can confirm it works on my LMDE.

  • visudo giving usage: visudo [-chqsV] [-f sudoers] [-x file]
    – gangadhars
    May 4, 2014 at 13:48
  • @SGG how are you running it? Did you run sudo visudo?
    – terdon
    May 4, 2014 at 13:49
  • i already tried with /etc/fstab. It gave me error at booting time Unable to mount /dev/sda6. press S to skip and M to manually ... some kind of message
    – gangadhars
    May 4, 2014 at 13:50
  • 1
    @SGG what worked? The sudo visudo works because that's the correct format for it, not sudo visudo /path/to/file. The fstab line works because the noauto option tells your system not to try and mount the drive automatically when booting. The users option tells it to allow regular users to mount.
    – terdon
    May 4, 2014 at 14:02
  • 1
    @SGG you need to save the file and exit visudo for the changes to take effect. If this is still not working, please update your question with the current contents of your sudoers file and the output of ls -l /etc/sudoers. Also make sure you tell us what operating system you're using. I'm guessing Linux but which one?
    – terdon
    May 4, 2014 at 14:13

That just tells the system that you may run all commands (which is the default anyway) but doesn't say anything about passwords. You need:


From the man page:


Full time sysadmins (millert, mikef, and dowdy) may run any command on any host without authenticating themselves.

  • not working. asking for password
    – gangadhars
    May 4, 2014 at 3:57
  • @SGG Quite strange because it does work here. What exactly is the command you run? May 4, 2014 at 4:13
  • i'm trying to run sudo mount -t vfat /media/sgg/D /dev/sda6
    – gangadhars
    May 4, 2014 at 4:55
  • @SGG It does not explain the password request but the mount command is wrong. It must be mount -t vfat /dev/sda6 /media/sgg/D. Please try sudo ls /root. May 4, 2014 at 5:15
  • sorry, that's a typo. Why when run the mount command it's asking pswd. I don't want to ask it. So that normal user can also mount.
    – gangadhars
    May 4, 2014 at 5:51

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