desm1 wrote:
<plist and script.log>
sudo launchctl bootout system/com.apple.osanalyticsdIn Terminal, run sudo nano /Library/Preferences/FeatureFlags/Domain/powerd.plist, paste Script 1 (from the Additional Text box), press Ctrl + O (then Enter) to save, and Ctrl + X to exit.
1. In Terminal, run sudo nano /etc/sudoers.d/btt_bluetooth, paste z ALL=(ALL) NOPASSWD: /usr/bin/pmset, /bin/launchctl, press Ctrl + O (then Enter) to save, and Ctrl + X to exit.
Oh, this is so dangerous and even partially incorrect!!
First, you should never, ever edit the "sudoers" file directly. In fact that file has a very clear & explicit warning at the beginning of that file.
Second, it is much better to put any such customizations into their own configuration file in the "/etc/sudoers.d" folder. Using the "visudo" command (you can configure it to use "nano" as the editor by prepending "EDITOR=nano") will ensure the correct permissions exist on any file edited & created for use by "sudoers" and it will ensure that the correct syntax is followed within that file before allowing the editor to close. This is critical because if the syntax is broken, then things will likely break because even the default configuration options in this file may not be read from a broken "sudoers" file.
Third, if you insert custom permissions/options at the wrong location in the "sudoers" file, then it can have even worse consequences than when they may be placed in the correct location.
If people make a mistake in editing "sudoers", then it will break macOS and may lead to a very difficult recovery. At least if a mistake is made in a separate configuration file it will help minimize some of the risk as the Finder can likely be used to rename/move the problem file which is much easier than trying to figure out how to fix that file...plus it is much easier to do this if the system must be booted into Recovery Mode to fix the problem with "sudoers".
Fourth, you should make sure to minimize any permissions given here by restricting the looser permissions only to very specific command options. For example, instead of allowing no password for all "pmset" options as you have done.....you should only include the very specific options required like: "/usr/bin/pmset -a hibernatemode 25", "/usr/bin/pmset schedule cancelall", and "/usr/bin/pmset sleepnow". This way if you were to use a different option, it would prompt you for a password.
Consider that you are allowing all "launchctl" options to be used for anything. This is extremely dangerous as anything could take advantage of your loose configuration to do more damage (intentionally or accidentally through a mistake or a bug). There can also be other unintended & unexpected side effects from other installed apps/utilities which may utilize these commands.
I may even be missing some things here.
People really need to think very carefully about making any modifications to "sudoers". In fact it is best to ask yourself if there is a better & safer way to achieve my goals so that "sudoers" does not need to be modified. If modifying "sudoers" is the only option, then make sure to limit those changes to very specific cases to minimize any unrealized consequences. Modifying "sudoers" should never be taken lightly.