From 2530c4fa6a8ce6bb2e28f70124dc6fe31e3bcf28 Mon Sep 17 00:00:00 2001 From: Jose Luis Duran Date: Mon, 4 Sep 2023 15:53:30 +0000 Subject: [PATCH] Allow sudo -g anyone and sudo -u anyone -g anytwo 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 --- scripts/vagrant.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/vagrant.sh b/scripts/vagrant.sh index 53a0a0c..53c0497 100755 --- a/scripts/vagrant.sh +++ b/scripts/vagrant.sh @@ -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