How is passwordless sudo achieved for the vagrant user?

162 views
Skip to first unread message

Daniel Gonzalez

unread,
Apr 5, 2018, 2:31:59 AM4/5/18
to Vagrant
I am confused. This is /etc/sudoers in my vagrant machine:

    vagrant@ubuntu-xenial:~$ sudo cat /etc/sudoers                                                                                                                                                                      
   
#
   
# This file MUST be edited with the 'visudo' command as root.
   
#
   
# Please consider adding local content in /etc/sudoers.d/ instead of
   
# directly modifying this file.
   
#
   
# See the man page for details on how to write a sudoers file.
   
#
   
Defaults        env_reset
   
Defaults        mail_badpass
   
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
   
   
# Host alias specification
   
   
# User alias specification
   
   
# Cmnd alias specification
   
   
# User privilege specification
    root    ALL
=(ALL:ALL) ALL
   
   
# Members of the admin group may gain root privileges
   
%admin ALL=(ALL) ALL
   
   
# Allow members of group sudo to execute any command
   
%sudo   ALL=(ALL:ALL) ALL
   
   
# See sudoers(5) for more information on "#include" directives:
   
   
#includedir /etc/sudoers.d

There is nothing in /etc/sudoers.d.

How is passwordless sudo achieved for the vagrant user?

The vagrant user is not even in the sudo group:

    vagrant@ubuntu-xenial:~$ id -a
    uid
=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant)

And, as expected, adding other users to the sudo group asks me for a password:

    user1@ubuntu-xenial:~$ sudo ls
   
[sudo] password for user1:


I would like to clarify these two questions:
  1. How does the vagrant user get sudo rights?
  2. How is passwordless sudo achieved for the vagrant user?

Alvaro Miranda Aguilera

unread,
Apr 5, 2018, 4:04:16 AM4/5/18
to vagra...@googlegroups.com
Hello

Which box are you using?

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/6b39e469-ef65-4e34-882d-6fd6a73c1024%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Daniel Gonzalez

unread,
Apr 5, 2018, 5:39:43 AM4/5/18
to Vagrant
I am using:

  config.vm.box = "ubuntu/xenial64"


To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.



--
Alvaro

Alvaro Miranda Aguilera

unread,
Apr 5, 2018, 6:04:15 AM4/5/18
to vagra...@googlegroups.com

I have this:



root@ubuntu-xenial:~# cat /etc/sudoers.d/vagrant 

vagrant ALL=(ALL) NOPASSWD:ALL

root@ubuntu-xenial:~# 




To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/c9560321-7da5-464b-b07c-46490dd5e462%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages