Skip to content

passwordless sudo on removing hosts not working #184

Open
@ndberg

Description

@ndberg

System: macOS Mojave 10.14.6

I updated the sudoers file as recommended in README, but it does not work for removing hosts. For adding the hosts it works. I changed it directly to my username Andi as it didn't work with the admin group:

# Allow passwordless startup of Vagrant with vagrant-hostsupdater.
Cmnd_Alias VAGRANT_HOSTS_ADD = /bin/sh -c echo "*" >> /etc/hosts
Cmnd_Alias VAGRANT_HOSTS_REMOVE = /bin/sed -i -e /*/ d /etc/hosts
Andi ALL=(root) NOPASSWD: VAGRANT_HOSTS_ADD, VAGRANT_HOSTS_REMOVE
➜  homestead git:(master) ✗ vagrant destroy
    platreform: Are you sure you want to destroy the 'platreform' VM? [y/N] y
==> platreform: Forcing shutdown of VM...
==> platreform: Destroying VM and associated drives...
==> platreform: Pruning invalid NFS exports. Administrator privileges will be required...
==> platreform: [vagrant-hostsupdater] Removing hosts
Password:

Does anyone know how the correct command in the sudoers file would be?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions