[macOS] Enable NOPASSWD sudo for @admin group (#11703)

This commit is contained in:
Erik Bershel
2025-03-03 23:57:21 +01:00
committed by GitHub
parent f0e516bc43
commit 9782878208
2 changed files with 15 additions and 0 deletions

View File

@@ -90,6 +90,12 @@ if [[ ! "$(automationmodetool)" =~ "DOES NOT REQUIRE" ]]; then
exit 1
fi
# Fix sudoers file permissions
sudo chmod 440 /etc/sudoers.d/*
# Add NOPASSWD for the current user to sudoers
sudo sed -i '' 's/%admin ALL = (ALL) ALL/%admin ALL = (ALL) NOPASSWD: ALL/g' /etc/sudoers
# Create symlink for tests running
if [[ ! -d "/usr/local/bin" ]];then
sudo mkdir -p -m 775 /usr/local/bin

View File

@@ -87,3 +87,12 @@ Describe "Unxip" {
"unxip --version" | Should -ReturnZeroExitCode
}
}
Describe "Sudoers" {
It "Sudo Cache" {
"sudo -v" | Should -ReturnZeroExitCode
}
It "Sudoers files" {
"sudo visudo -c" | Should -ReturnZeroExitCode
}
}