I need to edit /etc/sudoers from a script to add/remove stuff from white lists.
Assuming I have a command that would work on a normal file, how could I
This worked for me based off what others posted here. When i used other peoples script it would open visudo for me but would not make the edit. This made the edit i needed to allow all users, including standard users, to install java 7u17 for safari/firefox.
#!/usr/bin/env bash
rm /etc/sudoers.new
cp /etc/sudoers /etc/sudoers.new
echo "%everyone ALL = NOPASSWD: /usr/sbin/installer -pkg /Volumes/Java 7 Update 17/Java 7 Update 17.pkg -target /" >> /etc/sudoers.new
cp /etc/sudoers.new /etc/sudoers
This added the %everyone blah blah blah to the bottom of the sudoers file. I had to run the script like this.
sudo sh sudoersedit.sh
Good luck :D