2

I would like to run vagrant without being prompted for a password. As this post suggests, I used visudo to add the following line to my sudoers file.

john-moz ALL=(ALL) NOPASSWD: /usr/bin/vagrant

This does not seem to work. I am still prompted for a password when using vagrant. Am I doing something wrong?

3 Answers 3

1

Try

john-moz host = (root) NOPASSWD: /usr/bin/vagrant

You must change host to your hostname (probably also john-moz)

1
  • No luck, unfortunately. I notice that the vagrant script in turns starts up some other scripts. Perhaps the setting does not trickle down to them. Dec 18, 2013 at 21:02
1

Check where vagrant actually is: which vagrant. Maybe you have it installed as a gem (which is now obsolete way to install Vagrant).

But you really should never run Vagrant as a root. Why would you need to?

2
  • 1
    I installed Vagrant from a .deb that was downloaded on vagrantup.com. I'm not running Vagrant as root, but Vagrant does need my password to write to /etc/exports. Feb 5, 2014 at 19:53
  • Aah, now I understand your issue. I'll write a new answer.
    – tmatilai
    Feb 5, 2014 at 20:01
1

Vagrant itself runs many sudo commands to modify /etc/exports and restart the NFS server. You rule doesn't match any of those.

The used commands vary between host OSs and Vagrant versions, but the rules in this gist should be still quite close. You can probably see the commands for your version in /var/log/auth.log.

Hopefully a future Vagrant version will extract all this to a bundled script so you only need to add sudo permissions to that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .