diff --git a/lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb b/lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb index 6a3fced..379106d 100644 --- a/lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb +++ b/lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb @@ -176,10 +176,11 @@ def self.sshfs_slave_mount(machine, opts, hostpath, expanded_guest_path) sshfs_cmd+= sshfs_opts + ' ' + sshfs_opts_append + ' ' # The ssh command to connect to guest and then launch sshfs + # Note the backslash escapes for IdentityFile - handles spaces in key path ssh_opts = opts[:ssh_opts] ssh_opts+= ' -o User=' + machine.ssh_info[:username] ssh_opts+= ' -o Port=' + machine.ssh_info[:port].to_s - ssh_opts+= ' -o IdentityFile=' + machine.ssh_info[:private_key_path][0] + ssh_opts+= ' -o "IdentityFile=\"' + machine.ssh_info[:private_key_path][0] + '\""' ssh_opts+= ' -o UserKnownHostsFile=/dev/null ' ssh_opts+= ' -F /dev/null ' # Don't pick up options from user's config ssh_cmd = ssh_path + ssh_opts + ' ' + ssh_opts_append + ' ' + machine.ssh_info[:host] diff --git a/lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb b/lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb index 2aa5b23..1f8a1af 100644 --- a/lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb +++ b/lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb @@ -75,9 +75,10 @@ def self.sshfs_mount(machine, opts) opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives # SSH connection options + # Note the backslash escapes for IdentityFile - handles spaces in key path ssh_opts = opts[:ssh_opts] ssh_opts+= ' -o Port=' + machine.ssh_info[:port].to_s - ssh_opts+= ' -o IdentityFile=' + machine.ssh_info[:private_key_path][0] + ssh_opts+= ' -o "IdentityFile=\"' + machine.ssh_info[:private_key_path][0] + '\""' ssh_opts+= ' -o UserKnownHostsFile=/dev/null ' ssh_opts+= ' -F /dev/null ' # Don't pick up options from user's config