Merge pull request #5394 from hashicorp/docs_5191

add quoteless option to sudo example
This commit is contained in:
Matthew Hooker 2017-09-27 16:08:44 -07:00 committed by GitHub
commit 33af0c4c86
1 changed files with 6 additions and 0 deletions

View File

@ -123,6 +123,12 @@ Some operating systems default to a non-root user. For example if you login as
The `-S` flag tells `sudo` to read the password from stdin, which in this case
is being piped in with the value of `packer`.
The above example won't work if your environment vars contain spaces or single quotes; in these cases try removing the single quotes:
``` text
"echo 'packer' | sudo -S env {{ .Vars }} {{ .Path }}"
```
By setting the `execute_command` to this, your script(s) can run with root
privileges without worrying about password prompts.