diff --git a/plugins/hosts/linux/cap/nfs.rb b/plugins/hosts/linux/cap/nfs.rb index 2c7ee7eeb..adcd97dc2 100644 --- a/plugins/hosts/linux/cap/nfs.rb +++ b/plugins/hosts/linux/cap/nfs.rb @@ -1,4 +1,5 @@ require "vagrant/util" +require "vagrant/util/shell_quote" require "vagrant/util/retryable" module VagrantPlugins @@ -38,9 +39,8 @@ module VagrantPlugins nfs_cleanup(id) output.split("\n").each do |line| - # This should only ask for administrative permission once, even - # though its executed in multiple subshells. - system(%Q[echo '#{line}' | sudo tee -a /etc/exports >/dev/null"]) + line = Vagrant::Util::ShellQuote.escape(line, "'") + system(%Q[echo '#{line}' | sudo tee -a /etc/exports >/dev/null]) end if nfs_running?(nfs_check_command)