Skip to content

Commit

Permalink
support space in key file path
Browse files Browse the repository at this point in the history
Fixes #49
  • Loading branch information
dustymabe committed Oct 5, 2016
1 parent 73660e1 commit 3282831
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3282831

Please sign in to comment.