[MacPorts] #66557: Add to MacPorts Guide an explanation how to disable sudo password requirements for non-sensitive commands

MacPorts noreply at macports.org
Mon Dec 26 16:22:38 UTC 2022


#66557: Add to MacPorts Guide an explanation how to disable sudo password
requirements for non-sensitive commands
-------------------------+--------------------
 Reporter:  esbugz       |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  Normal       |  Milestone:
Component:  guide        |    Version:
 Keywords:               |       Port:
-------------------------+--------------------
 One of the more painful elements of using MacPorts vs Homebrew is the need
 for `sudo` for most operations.
 While some operations may benefit from such a security limit, not all do.
 For example, updating MacPorts itself or the port registry isn't a
 dangerous operation that installing a new package can be

 But it's possible to remove the pain and exclude these commands from
 requiring a password by editing your `/etc/sudoers` file (see an example
 below).
 It would be great is this were mentioned prominently in the **Guide**



 {{{
 ## !change 'YourUserNAME' below to your actual user name

 #↓ MacPorts: user can selfupdate, upgrade/uninstall any package (or use
 %staff group instead of YourUserName)
 YourUserNAME ALL=(root) NOPASSWD: /opt/local/bin/port selfupdate *      #
 MacPorts: update MacPorts base code & Portfiles
 YourUserNAME ALL=(root) NOPASSWD: /opt/local/bin/port upgrade    *      #
 MacPorts: upgrade   a package
 YourUserNAME ALL=(root) NOPASSWD: /opt/local/bin/port clean      *      #
 MacPorts: clean intermediate files
 YourUserNAME ALL=(root) NOPASSWD: /opt/local/bin/port reclaim    *      #
 MacPorts: cleanup inactive ports
 YourUserNAME ALL=(root) NOPASSWD: /opt/local/bin/port_cutleaves         #
 MacPorts: uninstall unneded dependencies (leaves)
 YourUserNAME ALL=(root) NOPASSWD: /opt/local/bin/port uninstall  *      #
 MacPorts: uninstall a package

 #
 #UserList HostList=EffectiveUserList TagList CommandList
 #↑ list of users already created
 #         ↑ list of hosts where the users can run sudo
 #                  ↑ list of the users who might be running as an alias
 # tags such as NOPASSWD              ↑
 # commands we don't want to write the passwords to↑
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/66557>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list