Screwed up administrative name on sudo when trying to change usernames

passwordpermissionsudoterminal

Disclaimer: I am NOT at all fluent in coding or its jargon, so bear with me.

I recently downloaded a software and wanted to remove it. I tried to do it via sudo on the MacBook terminal. I was trying to follow the advice from this website: http://osxdaily.com/2014/02/06/add-user-sudoers-file-mac/

Incidentally, I literally typed "username" instead of my actual username for my actual account. Now I can't even touch sudo or do anything with it.

I try to type visudo and it says "permission denied." I try to type sudoer and it doesn't give me the prompt to type the password like it did before and it doesn't respond to any input I place in, whether it is spam or a helpless help command.

I followed the advice here and it still doesn't work. Now I have two admin accounts. I am beyond lost now as to how to revert my sudo thing.

Edit: I ran the code ls -l /etc/sudoers and the results were -r--r----- 1 root wheel 2306 May 7 02:21 /etc/sudoers

Inputed cat /etc/sudoers command. Embarrassing username from middle school inbound:

enter image description here

Best Answer

  • Reboot into Single User mode
  • Run /sbin/fsck -fy
  • Run /sbin/mount -uw /
  • Run vi /etc/sudoers (assuming you know vi, otherwise use nano)
  • In the "User privilege specification" part replace %awesomechris with %admin (the % is important)
  • Save and reboot

PS: The % identicates a user group, so creating a new user didn't help (even if you would have named it awesomechris instead of username)

PPS: Once everything is fixed, remove Admin rights from users who don't need it (make sure at least one is left). Then log in with an admin user, run sudo WHATEVER-IS-NEEDED-TO-REMOVE-YOUR-SOFTWARE and enter the password of the same admin user to confirm).