I am a new student about vagrant. I just found that I can change to root by "sudo su -" without entering a password when inside the box supervised by Vagrant. Curiously I checked the "/etc/sudoers" and found nothing about user vagrant. Can anyone kindly explain this?
If your timestamp_timeout is zero, sudo always prompts for a password. This feature can be enabled only by the superuser, however. Ordinary users can achieve the same behavior with sudo -k, which forces sudo to prompt for a password on your next sudo command.
/etc/sudoers include another file which contains the NOPASSWD line.
vagrant@ubuntu-12:~$ sudo cat /etc/sudoers.d/vagrant
%vagrant ALL=NOPASSWD:ALL
Based on http://docs.vagrantup.com/v2/boxes/base.html: "Many aspects of Vagrant expect the default SSH user to have passwordless sudo configured. This lets Vagrant configure networks, mount synced folders, install software, and more."
As moodh mentioned,
vagrant ALL=(ALL) NOPASSWD: ALL
will allow "password-less" sudo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With