Skip to content

Commit

Permalink
Allow sudo -g anyone and sudo -u anyone -g anytwo
Browse files Browse the repository at this point in the history
When only the user (ALL) is specified explicitly, and the group is
implied, only sudo -u works. Specifying both the user and group, like
(ALL:ALL), is required to:

1. Use sudo -g by itself (with no -u user)
2. Use sudo -u and -g together, with a -g group that is different from
   the -u user's primary group
  • Loading branch information
jlduran committed Sep 4, 2023
1 parent d952e95 commit 2530c4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/vagrant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pw useradd -n vagrant -u 1001 -c 'Vagrant User' -d /home/vagrant \
-g 1001 -G 0 -m -M 0755 -w yes -s /usr/local/bin/bash

# Configure sudo to allow the vagrant user
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /usr/local/etc/sudoers.d/vagrant
echo 'vagrant ALL=(ALL:ALL) NOPASSWD: ALL' > /usr/local/etc/sudoers.d/vagrant
chmod 0440 /usr/local/etc/sudoers.d/vagrant

# Configure passwordless su to wheel users
Expand Down

0 comments on commit 2530c4f

Please sign in to comment.