Opened 16 months ago

#66557 new enhancement

Add to MacPorts Guide an explanation how to disable sudo password requirements for non-sensitive commands

Reported by: esbugz Owned by:
Priority: Normal Milestone:
Component: guide Version:
Keywords: Cc:
Port:

Description

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↑

Change History (0)

Note: See TracTickets for help on using tickets.