1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 16:10:08 +01:00

Fix "sudo: sorry, you are not allowed to preserve the environment" messages

If you've previously run `valet trust` to allow valet to run without specifying `sudo` repeatedly or entering your password with various valet commands, recent updates to MacOS may give you a `sudo: sorry, you are not allowed to preserve the environment` response when trying to run those `valet` commands.

The fix is in updating the sudoers entry that `valet trust` creates.

This PR tells valet how to update the sudoers entry so that this message doesn't continue.

YOU WILL NEED TO RE-RUN `valet trust` IF YOU HAD PREVIOUSLY RUN IT, after installing this update, in order for this code change to have any effect.

(Technical explanation: the sudoers protections have become stricter, so we have to be more explicit that we do indeed want environment variables to flow through to the sudo user's environment when using valet via sudoers entries.)
This commit is contained in:
Chris Brown
2019-05-14 16:55:27 -04:00
parent f22cb36c2b
commit fee6fec141
2 changed files with 2 additions and 2 deletions

View File

@@ -272,7 +272,7 @@ function createSudoersEntry()
$this->files->ensureDirExists('/etc/sudoers.d');
$this->files->put('/etc/sudoers.d/brew', 'Cmnd_Alias BREW = /usr/local/bin/brew *
%admin ALL=(root) NOPASSWD: BREW'.PHP_EOL);
%admin ALL=(root) NOPASSWD:SETENV: BREW'.PHP_EOL);
}
/**

View File

@@ -79,6 +79,6 @@ function createSudoersEntry()
$this->files->ensureDirExists('/etc/sudoers.d');
$this->files->put('/etc/sudoers.d/valet', 'Cmnd_Alias VALET = /usr/local/bin/valet *
%admin ALL=(root) NOPASSWD: VALET'.PHP_EOL);
%admin ALL=(root) NOPASSWD:SETENV: VALET'.PHP_EOL);
}
}