0

I wonder is there a way to set user in vagrant configuration, so that box will be provisioned from non-root account? The thing is that I want to run chef-client on boxes as specific user (deployer), and not root, but for that I should run provisioner and create this user first, and this provisioner is created under root user.

As I understand, the one solution is to run provisioning for create deployer user, and then change all chef-related files and directories on box to be owned by deployer user, and then run the actual provisioning from chef server.

Is there some better solution?

sandric
  • 2,310
  • 3
  • 21
  • 26

1 Answers1

0

Forgive me if I'm just restating the second half of your question but it seems like you may want to create a minimal starting provisioner (runs as root) then spawn another provisioner as your intended user.

Here is an example of how I install my dotfiles as my ssh user (vagrant)

# ... in shell provision script...
su -c "cd /home/vagrant/.dotfiles && bash install.bash" vagrant

Similar Vagrant github issue

Chris Bosco
  • 1,080
  • 10
  • 16