macOS sudo without password prompt

macOS sudo without password prompt

#as root edit /etc/sudoers

AKA “sudo visudo” *OR* as root e.g. “whoami” on terminal says “root” — e.g.:

macuser1@macbookpro ~ % 

#run visudo as root

Confirm you are root using “whoami” as shown below (or using “sudo visudo” and/or “vi /etc/sudoers” as root):

    sh-3.2# whoami

    root

    sh-3.2#

    sh-3.2# visudo

    sh-3.2#

    sh-3.2#

Original /etc/sudoers should contain a text block near the end of the file as follows:

root      ALL = (ALL) ALL

#%admin      ALL = (ALL) ALL

macadmin ALL = (ALL) ALL

Adjust to

#modify line to include NOPASSWD: after (ALL)

%admin    ALL = (ALL) NOPASSWD: ALL

#add line to allow standard user to sudo without password

macuser1           ALL = (ALL) NOPASSWD: ALL

#comment out original/save for backup

#%admin         ALL = (ALL) ALL

No comments yet.

Leave a Reply