linux - How do I make sudo ask for the root password?

07
2014-07
  • David Z

    When I run sudo as a normal unprivileged user, it asks for my password, not the root password. That's often convenient, but it reduces the amount of information someone would have to have in order to run commands as root. So how can I make sudo ask for the root password instead of the invoking user's password?

    I know it'd be done with a line in /etc/sudoers, but I can never seem to properly parse the BNF grammar in the man page to figure out exactly what to write.

  • Answers
  • David Pearce

    Ok, here it is again so you can set the checkmark.

    In /etc/sudoers, add this line:

    Defaults rootpw
    

    to turn on the rootpw flag, making sudo ask for the root password.

  • Ignacio Vazquez-Abrams

    You need to turn the rootpw flag on.

  • Nitrodist

    You could just turn off sudo and use su -c.

  • Seasoned Advice (cooking)

    Using

    sudo su

    will let you run as many commands as you want in succession.


  • Related Question

    linux - Make sudo ask for my password again?
  • Brendan Long

    Is there any way to make sudo forget my password instantly instead of remembering it for 5 minutes?


  • Related Answers
  • Blorgbeard

    Edit your sudoers file by running visudo as root.

    Look for the Defaults line, and add timestamp_timeout=0 to the end.

    Eg.

    Defaults env_reset,timestamp_timeout=0

    (Edited: Sorry, got confused, had the wrong keyword. Fixed. )

  • Abtin Forouzandeh

    If you just want to make sudo ask again for the current session

    sudo -k