Book Image

Creating Development Environments with Vagrant

By : MICHAEL KEITH PEACOCK
Book Image

Creating Development Environments with Vagrant

By: MICHAEL KEITH PEACOCK

Overview of this book

Table of Contents (17 chapters)
Creating Development Environments with Vagrant Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Vagrant authentication


Vagrant communicates with base boxes over SSH. Vagrant itself has a private key, for which we need to install the corresponding public key into the virtual machine. Vagrant expects a specific user with a predefined password to also be within the machine, and the user needs to be configured so that it isn't prompted for the password when attempting to perform actions that require elevated privileges (sudo).

Vagrant user and admin group

Provided we created the Vagrant user during the installation process (as per the main account user and password mentioned earlier), we then need to create an admin group and add the Vagrant user to this group.

First, we need to create the group:

Sudo groupadd admin

To add the Vagrant user to this group, run the following command:

Sudo usermod -a -G admin vagrant

The sudoers file

In order to stop the virtual machine asking for the user's password when running elevated actions, we need to modify the sudoers file. This is a file that tells the...