On Ubuntu you can do something like this:
sudo adduser {username} www-data
That doesn't work on OS X, and may not be the best approach anyway. On OS X, how can you make Apache start or stop without having to enter a password?
apachemacos
On Ubuntu you can do something like this:
sudo adduser {username} www-data
That doesn't work on OS X, and may not be the best approach anyway. On OS X, how can you make Apache start or stop without having to enter a password?
Best Answer
Open Terminal and enter
sudo visudo
to modify the file /etc/sudoers.Change the part:
to
and save the file.
If you don't know vi: after entering
sudo visudo
you have to change to insert mode by hitting i. Enter the additional line as indicated above. To leave insert mode hit esc. Then enter :wq and the Enter key to write the modified file to disk and quit vi.Starting and stoping Apache with
sudo apachectl start
orsudo apachectl stop
doesn't require a password anymore.apachectl
requires root/sudo to execute it. Only the root user can execute the command without entering a password. Neither adding a user to the admin group nor to another group (e.g. _www) allows to execute(sudo )apachectl
without password.So, the least intrusive method is adding a user - even a standard user - in the sudoers file and restrict the account to execute /usr/sbin/apachectl only. The added user is not allowed to execute any other command as sudoer!