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?

1

Try

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

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

| improve this answer | |
  • 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. – fallingplates Dec 18 '13 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?

| improve this answer | |
  • 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. – fallingplates Feb 5 '14 at 19:53
  • Aah, now I understand your issue. I'll write a new answer. – tmatilai Feb 5 '14 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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.