diff --git a/lib/vagrant/action/builtin/ssh_run.rb b/lib/vagrant/action/builtin/ssh_run.rb index 4e714837c..3636f1ab8 100644 --- a/lib/vagrant/action/builtin/ssh_run.rb +++ b/lib/vagrant/action/builtin/ssh_run.rb @@ -1,6 +1,7 @@ require "log4r" require "vagrant/util/ssh" +require "vagrant/util/shell_quote" module Vagrant module Action @@ -33,10 +34,7 @@ module Vagrant end # Get the command and wrap it in a login shell - command = env[:ssh_run_command] - command = command.gsub(/'/) do |m| - "#{m}\\#{m}#{m}" - end + command = ShellQuote.escape(env[:ssh_run_command], "'") command = "#{env[:machine].config.ssh.shell} -c '#{command}'" # Execute!