Sample Header Ad - 728x90

user is not in the sudoers file macOS catalina

2 votes
2 answers
8331 views
I'm using macOS catalina 10.15.7. I recently found out i cannot run sudo anymore, tried to run sudo brew install nats-server, and got this message: is not in the sudoers file. This incident will be reported. I got my username by whoami. By running id, i see 80(admin) was listed there. Went to System Preferences -> Users & Groups, I saw my name (full name not my username) is listed under Current User as Admin, Mobile.enter image description here Followed other posts online, i was able to find /etc/sudoers.d folder and sudoers file, and right click get Info, i added my username back to the permission list which allow me to read and write, the changes were made to both /etc/sudoers.d folder and sudoers file. enter image description here At one point of time i was able to run sudo visudo /private/etc/sudoers and found out the line for admin was commented out, so i removed the comment to re-enable it, now the file has root and admin enabled, no other user: root ALL = (ALL) ALL admin ALL = (ALL) ALL and at the bottom of the file, i saw: ## Read drop-in files from /private/etc/sudoers.d ## (the '#' here does not indicate a comment) #includedir /private/etc/sudoers.d after all these changes i still cannot run sudo: sudo brew update sudo: 4294967295,2416387072,32767,0,0,0,0,0,0,0: invalid value sudo: error initializing audit plugin sudoers_audit sudo brew update Password: is not in the sudoers file. This incident will be reported is admin and my username the same user? it should be, right? do i have to add my username in /private/etc/sudoers file separately? Update: run id -un, it shows my username run ls -l /etc/sudoers, it shows: -r--r-----+ 1 root wheel 1562 Jun 29 10:06 /etc/sudoers
Asked by user468587 (121 rep)
Jun 29, 2021, 06:59 PM
Last activity: Mar 12, 2025, 05:44 PM