I want to give myself permissions to use pmset
without using sudo
.
I added this line to etc/sudoers
:
myname ALL = /usr/bin/pmset
But when I save and close with :wq
and run pmset
, I get:
$ pmset -b disablesleep 1
'pmset' must be run as root...
What is it I'm doing wrong?
Best Answer
The
sudoers
file only gets read bysudo
so you still need to runto execute the command. What your addition to
sudoers
does is that every user on your Mac can now executepmset
without entering a password (or even be in the admin group).If you want to avoid having to type
sudo pmset
each time define an alias