Why can user vagrant do "sudo su -" without entering password?
12,166
Solution 1
/etc/sudoers include another file which contains the NOPASSWD line.
vagrant@ubuntu-12:~$ sudo cat /etc/sudoers.d/vagrant
%vagrant ALL=NOPASSWD:ALL
Solution 2
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.
Related videos on Youtube

Author by
Vincentge
Updated on October 24, 2022Comments
-
Vincentge 7 months
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?
-
sparebytes about 7 yearsMy quick workaround is to use
sudo su -
-
-
Prashant Pathak about 3 yearsI am using vagrant 2.2.4 and trying to do vagrant up in powershell window environment, I end with an error "The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong." I see from the net that I should add vagrant ALL=(ALL) NOPASSWD:ALL , But I am not able to understand where I should add this information if I am using window 10 and running vagrant up on windows Powershell.