I accidentally made a mistake and made my
sudo commands passwordless on my Mac. How can I get it back to default?
Does your account have root/sudoer privs?
If so, try:
That puts you into super user mode based on your account, and then resets the root password (which may do what you need since you said the visudo file sounds about right.).
You either added the
In any case, edit
For example, with these entries I can run any command without being asked for a password:
On the other hand, if the entry lacks
You can have both behaviors with an entry like this:
Here I need to authenticate for any command except for
You can edit the sudoers file to make sudo require a password again. You need to edit this file using the sudo visudo command in a terminal session and removing the line:
which is probably near the end of the file. Then save (write) the file and quit. The visudo command verifies the new file and "installs" it. You may need to restart or at least logoff and on to have this take place.
Note that the visudo command puts you in the vi editor so you need to know a little about using vi to make the changes.
Look in /etc/sudoers for 'NOPASSWD:' and remove it. If you're game, try running this in a terminal window: