From 35f83b6fed9055cda9cc6ac39e8044a0a19806ec Mon Sep 17 00:00:00 2001 From: Tomoyuki Sakurai Date: Tue, 4 Oct 2016 17:21:11 +0900 Subject: [PATCH] use '-o IdentityFile=' instead of '-i' fixes ssh failure when path to the key contains '%'. --- lib/vagrant/util/ssh.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/util/ssh.rb b/lib/vagrant/util/ssh.rb index 45efddfbe..8177cbc2a 100644 --- a/lib/vagrant/util/ssh.rb +++ b/lib/vagrant/util/ssh.rb @@ -135,7 +135,11 @@ module Vagrant # If we're not in plain mode and :private_key_path is set attach the private key path(s). if !plain_mode && options[:private_key_path] options[:private_key_path].each do |path| - command_options += ["-i", path.to_s] + + # Use '-o' instead of '-i' because '-i' does not call + # percent_expand in misc.c, but '-o' does. when passing the path, + # replace '%' in the path with '%%' to escape the '%' + command_options += ["-o", "IdentityFile=%s" % [path.to_s.gsub('%', '%%')]] end end