Skip to content

Instantly share code, notes, and snippets.

@lee-pai-long
Last active March 2, 2017 14:29
Show Gist options
  • Save lee-pai-long/8237b6b107a0a514d887 to your computer and use it in GitHub Desktop.
Save lee-pai-long/8237b6b107a0a514d887 to your computer and use it in GitHub Desktop.

[VAGRANT] Passwordless sudo for the vagrant-hostmanager plugin


Create a file in the sudoers.d directory

$ [sudo] vim /etc/sudoers.d/vagrant-hostmanager

Put this two line in it

Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp <HOME>/.vagrant.d/tmp/hosts.local /etc/hosts
%sudo ALL=(root) NOPASSWD: VAGRANT_HOSTMANAGER_UPDATE

Note: In debian-like distribution the sudoer group is called sudo whereas in RHEL familly the group is wheel so change the second line consenquently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment