linux - How do I make sudo ask for the root password?
2014-07
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.
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.
You need to turn the rootpw
flag on.
You could just turn off sudo and use su -c
.
Using
sudo su
will let you run as many commands as you want in succession.
Is there any way to make sudo
forget my password instantly instead of remembering it for 5 minutes?
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. )
If you just want to make sudo ask again for the current session
sudo -k