0

I was/am trying to run terminal commands without having to use sudo first and must have broke the file. Now I'm trying to fix it and it's giving me this error when I try to edit with the same sudo visudo command.

/etc/sudoers: syntax error near line 62 <<< sudo: parse error in /etc/sudoers near line 62 sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin

I'm on a Mac using Terminal

Is there a way to edit this file and remove what I added or reset it without harming or removing other files?

4
  • Is there some reason why you cannot su to root and edit the sudoers file directly? Commented Jan 19, 2021 at 21:31
  • @FeliniusRex Because root is not enabled. The obvious answer is to copy the file back from a backup - although admin role might be broken as well - so do it rebooting into single user mode
    – mmmmmm
    Commented Jan 19, 2021 at 23:11
  • @mmmmmm The OP didn't say that. How do you know that? Commented Jan 20, 2021 at 3:09
  • @FeliniusRex because it is the macOS default so it is best to assume that root is not enabled. If you have enabled root I would assume you don't really use sudo
    – mmmmmm
    Commented Jan 20, 2021 at 11:36

0

Browse other questions tagged .