1

When I type 'sudo' before command to act as a superuser, it never ask me for the password at all. I didn't remember what I did.

2 Answers 2

5

Check your sudoers privilege. Sometimes permission might be over written. Do the follow:

cd /etc/sudoers.d
sudo visudo 

I will assume you will have

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

Change it to

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

Hope it help :)

6
  • How I can save changes with visudo after editing? My Ubuntu is 14.04LTS.
    – user281814
    Jun 8, 2014 at 11:15
  • exit the editing mode (esc) then type :x or :wq (then enter)
    – OdinRW
    Jun 8, 2014 at 11:40
  • It also not work, I can't exit from editing mode, it's not like vi editor
    – user281814
    Jun 8, 2014 at 11:43
  • It's working fine for me!
    – OdinRW
    Jun 8, 2014 at 11:44
  • 1
    It only works with pressing Ctrl+Shift+x
    – user281814
    Jun 8, 2014 at 11:56
2

During a single session, sudo may only ask for your password the first time you use sudo.

Use

sudo -K

when you are done using sudo to revoke that status.

2
  • Even I make restart it still doesn't ask me for password
    – user281814
    Jun 8, 2014 at 11:25
  • Aah yes, I see that NOPASSWD was probably the culprit. BTW, it is possible to edit the sudoers file with vi, nano, gedit, or whatever but it not recommended because syntax errors will not be fixed and you might be left without the needed sudo privilege to fix it.
    – mchid
    Jun 9, 2014 at 15:54

You must log in to answer this question.

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