Skip to content

Commit

Permalink
fix passwordless sudo for Sierra
Browse files Browse the repository at this point in the history
  • Loading branch information
atomantic committed Feb 10, 2017
1 parent 5605cd4 commit 877ea43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* remove yo, generator-dockerize, box-sync from software installs
* install node stable (rather than old 4.x.x version)
* make gitshots optional (and only install `imagesnap` and `imagemagick` if this is on)
* fix passwordless sudo for Sierra (optional)

## v4.3.0
* vim installation fix
Expand Down
9 changes: 3 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ source ./lib_sh/requirers.sh
bot "Hi! I'm going to install tooling and tweak your system settings. Here I go..."

# Ask for the administrator password upfront
if sudo grep -q "# %wheel\tALL=(ALL) NOPASSWD: ALL" "/etc/sudoers"; then
if ! sudo grep -q "%wheel ALL=(ALL) NOPASSWD: ALL #atomantic/dotfiles" "/etc/sudoers"; then

# Ask for the administrator password upfront
bot "I need you to enter your sudo password so I can install some things:"
Expand All @@ -26,11 +26,8 @@ if sudo grep -q "# %wheel\tALL=(ALL) NOPASSWD: ALL" "/etc/sudoers"; then
read -r -p "Make sudo passwordless? [y|N] " response

if [[ $response =~ (yes|y|Y) ]];then
sed --version 2>&1 > /dev/null
sudo sed -i '' 's/^#\s*\(%wheel\s\+ALL=(ALL)\s\+NOPASSWD:\s\+ALL\)/\1/' /etc/sudoers
if [[ $? == 0 ]];then
sudo sed -i 's/^#\s*\(%wheel\s\+ALL=(ALL)\s\+NOPASSWD:\s\+ALL\)/\1/' /etc/sudoers
fi
sudo cp /etc/sudoers /etc/sudoers.back
echo '%wheel ALL=(ALL) NOPASSWD: ALL #atomantic/dotfiles' | sudo tee -a /etc/sudoers > /dev/null
sudo dscl . append /Groups/wheel GroupMembership $(whoami)
bot "You can now run sudo commands without password!"
fi
Expand Down

0 comments on commit 877ea43

Please sign in to comment.