Skip to content

SiM07/vagrant-passwordless-sudo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Vagrant Passwordless Sudo

This script automatically modifies /etc/sudoers to allow commands like vagrant up to proceed without asking for your sudo password.

Supported features:

Tested with Vagrant 1.4.

Current version supports OS X only.

This script was inspired by and is based on Nick Muerdter's install_vagrant_sudoers.sh.

Usage

$ sudo ./vagrant-passwordless-sudo.sh
Password:
All done, vagrant should not ask for your sudo password anymore!

The following lines will be appended to your /etc/sudoers:

##### BEGIN VAGRANT PASSWORDLESS SUDO #####
###
### Generated by vagrant-passworless-sudo, modify at your own risk!
###

# NFS commands
Cmnd_Alias VAGRANT_EXPORTS_ADD = /bin/bash -c echo '*' >> /etc/exports
Cmnd_Alias VAGRANT_NFSD_RESTART = /sbin/nfsd restart
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports
%staff ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD_RESTART, VAGRANT_EXPORTS_REMOVE

# vagrant-hostsupdater commands
Cmnd_Alias VAGRANT_HOST_ADD = /bin/sh -c echo "*" >> /etc/hosts
Cmnd_Alias VAGRANT_HOST_REMOVE = /usr/bin/sed -i -e /*/ d /etc/hosts
%staff ALL=(root) NOPASSWD: VAGRANT_HOST_ADD, VAGRANT_HOST_REMOVE
##### END VAGRANT PASSWORDLESS SUDO #####

The script cleans after itself, so it's completely safe to re-run it at any time.

About

Allows you to skip sudo password prompt during `vagrant up`

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published