LoginSignup
1
1

More than 5 years have passed since last update.

MacでVagrant使うときいつも/etc/sudoersに書くやつ

Posted at

NFS マウントと hostsupdater プラグインを使うときパスワードを入力しなくてもいいようにするには以下を /etc/sudoers に追記。

/etc/sudoers
    :
    :

# Allow passwordless startup of Vagrant when using NFS.
# https://gist.github.com/joemaller/6764700
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports
%admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE

# Allow passwordless startup of Vagrant with vagrant-hostsupdater.
# https://github.com/cogitatio/vagrant-hostsupdater#linuxos-x-passwordless-sudo
Cmnd_Alias VAGRANT_HOSTS_ADD = /bin/sh -c echo "*" >> /etc/hosts
Cmnd_Alias VAGRANT_HOSTS_REMOVE = /usr/bin/sed -i -e /*/ d /etc/hosts
%admin ALL=(root) NOPASSWD: VAGRANT_HOSTS_ADD, VAGRANT_HOSTS_REMOVE
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1