How I broke sudo on my Dads Mac and how I fixed it
The Problem
I then installed Nix on the Mac and got everything working, but as I wanted to build my NixOS Configuration on the Mac, the build failed. It failed, because I couldn’t enter the sudo password. After much browsing the web, I wanted to make sudo passwordless. So I open visudo
and changed
%admin ALL=(ALL) ALL
to
%admin ALL=(ALL) :NOPASSWD ALL
Do you see the mistake? It’s the wrong place column. But I was in a rush, saved the file, wanted to test out my new fancy passwordless sudo by running sudo echo test
and got greeted by a alex is not in suderos file
.
The Journey begins
Try 1
I tried out the here described “Finder” solution but failed. I just couldn’t change the permission back. An hour later, I moved on to recovery mode.
Try 2 — Recovery Mode, my savior
So, I finally booted into recovery mode, and logged in. Then mounted the Data disk via the disk utility program.
Now I could open a terminal, navigate to /foo/bar/etc
and repair the file permission while also fixing the typo.
What I’ve learned
- If visudo asks you if you really want to save the File, don’t blindly type yes!
- root is your friend
I would love to hear about your funny tech fails. Just send me an email.
Thoughts, feedback, questions? I would like to hear about them! Just drop me an email at hello[at]confusedalex.dev
Webmentions
No webmentions yet. Be the first to comment, like or repost!