Created
May 19, 2017 05:16
-
-
Save gamunu/95cad7b5f536e20f38843217443f3e51 to your computer and use it in GitHub Desktop.
Using NFS shares from Vagrant without password prompts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Allow Vagrant to manage /etc/exports | |
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports | |
Cmnd_Alias VAGRANT_NFSD_CHECK = /usr/bin/systemctl status --no-pager nfs-server.service | |
Cmnd_Alias VAGRANT_NFSD_START = /usr/bin/systemctl start nfs-server.service | |
Cmnd_Alias VAGRANT_NFSD_APPLY = /usr/sbin/exportfs -ar | |
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /bin/sed -r -e * d -ibak /*/exports | |
Cmnd_Alias VAGRANT_EXPORTS_REMOVE_2 = /bin/cp /*/exports /etc/exports | |
%vagrant ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD_CHECK, VAGRANT_NFSD_START, VAGRANT_NFSD_APPLY, VAGRANT_EXPORTS_REMOVE, VAGRANT_EXPORTS_REMOVE_2 | |
Afterwards add yourself to the vagrant group if you are not there already by running: | |
$ sudo getent group vagrant >/dev/null || sudo groupadd -r vagrant | |
$ sudo gpasswd -a ${USER} vagrant | |
$ newgrp vagrant |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment