mirror of
https://github.com/actions/runner-images.git
synced 2025-12-11 03:27:05 +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
|
||||
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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user