Dannymac22 wrote:
Actually, looking back at my original post, the syntax error is NOT in /private/etc/sudoers, but /private/etc/suduers.d/suduers, which is a file that contains PRECISELY ONE line.
FYI, you just made two typographical errors in the path here.....missing the "o" in "sudoers.d" and "sudoers".
As others have already mentioned, there is no need for the line used anyway, so you can just delete that file if it only contains the single line.
Dannymac22 wrote:
The line with the syntax error. That is NOT the file that visudoers edits. So why the h is the system using THAT sudoers file instead of /private/etc/suduers?
FYI, again the typographical error in "sudoers". Sorry, but when working on the command line and with system files, you must be extremely careful of everything you do and you must be precise or you may encounter more serious & devastating errors & consequences. The command line is very unforgiving and there are no safety nets. I also would recommend not using "sudoers" as the name of a custom file to minimize confusion.
"visudo" will edit the main "/etc/sudoers" file unless told otherwise.
To edit another file you need to use the following command (may not need the "-f", but I'm not sure what version of visudo your version of macOS is using so I'm including it here just to be safe):
sudo visudo -f /etc/sudoers.d/sudoers
Personally I prefer to use the "nano" text editor as it is easier for me. I just cannot remember all the options for using "vi" or "vim" which is the default editor if none is specified (I know "vi" & "vim" are very powerful and useful for many people & situations):
EDITOR=nano sudo visudo -f /etc/sudoers.d/sudoers
Note: Using the path with or without "/private" in the path is acceptable since "/etc" is a link to "/private/etc".
Also, to learn about any commands on the command line you can use the manual pages on most commands. For example, to learn about "visudo" and its options, you would use:
man visudo
Edit: I'm glad you were making customizations by adding configuration files to "/etc/sudoers.d" as that is a much safer option in case of a mistake as you can easily move/delete the file from that folder if a mistake breaks the command line. I never edit the main "/etc/sudoers" file for this reason. Plus if an OS update decides to rewrite the file to a default, you shouldn't lose your customizations....or it will be much easier to restore those files. In addition it is much easier to view all the customizations in their own individual files and quickly remove them or the files when troubleshooting.