mirror of
https://github.com/actions/runner-images.git
synced 2025-12-12 20:26:49 +00:00
[macOS] Enable NOPASSWD sudo for @admin group (#11703)
This commit is contained in:
@@ -90,6 +90,12 @@ if [[ ! "$(automationmodetool)" =~ "DOES NOT REQUIRE" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# Create symlink for tests running
|
||||||
if [[ ! -d "/usr/local/bin" ]];then
|
if [[ ! -d "/usr/local/bin" ]];then
|
||||||
sudo mkdir -p -m 775 /usr/local/bin
|
sudo mkdir -p -m 775 /usr/local/bin
|
||||||
|
|||||||
@@ -87,3 +87,12 @@ Describe "Unxip" {
|
|||||||
"unxip --version" | Should -ReturnZeroExitCode
|
"unxip --version" | Should -ReturnZeroExitCode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Describe "Sudoers" {
|
||||||
|
It "Sudo Cache" {
|
||||||
|
"sudo -v" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
It "Sudoers files" {
|
||||||
|
"sudo visudo -c" | Should -ReturnZeroExitCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user