During provision, how do you change to "vagrant" user?

2,871 views
Skip to first unread message

Gerry Kaplan

unread,
Dec 20, 2014, 11:04:08 PM12/20/14
to vagra...@googlegroups.com
During provisioning with a shell script, is it possible to change to the "vagrant" user and execute commands?

My goal is this:
1. Install various server components (i.e. git, nodejs, etc.)
2. switch to the vagrant user
3. Install nvm from this curl script: curl https://raw.githubusercontent.com/creationix/nvm/v0.20.0/install.sh | bash

When I run step #3 from a shell script, it does it as "root" and not "vagrant". How can I switch to the vagrant user, then execute the curl command?

Alvaro Miranda Aguilera

unread,
Dec 21, 2014, 12:47:05 AM12/21/14
to vagra...@googlegroups.com
Hello, by default shell provisioner will run a s prvileded user, and will do sudo to run

this can overrriden with:

 config.vm.provision "shell", path: privileged false

privileged (boolean) - Specifies whether to execute the shell script as a privileged user or not (sudo). By default this is "true". This has no effect for Windows guests

Alvaro



--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gerry Kaplan

unread,
Dec 21, 2014, 3:12:08 AM12/21/14
to vagra...@googlegroups.com
Thank you!

--
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/ScRQNbEmj9M/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages