How to setup vagrant-sshfs for work properly in Win10 with Hyper-V?

0

1

I am trying to setup Vagrant and Hyper-V and it is almost done but folder sharing is failing because I refuse to use SMB and instead I want to use vagrant-sshfs. It is know that in Windows system requires to have an sftp-server which is usually provided by OpenSSH and for that reason I have followed this instructions to install OpenSSH in Windows 10.

This is how my Vagrantfile looks like:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.network :forwarded_port, host: 8080, guest: 80
  config.vm.network "private_network", ip: "192.168.50.4"
  config.vm.synced_folder "../../applications", "/var/www", type: "sshfs", , sshfs_opts_append: "-o cache=no"

  config.vm.provider :hyperv do |vb|
    vb.memory = "2048"
    vb.vmname = "centos7"
  end
end

When I ran the command vagrant up I got the following:

λ vagrant up
Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Verifying Hyper-V is accessible...
    default: Configuring the VM...
==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
    default: Timeout: 120 seconds
    default: IP: 192.168.0.103
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 192.168.0.103:22
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Mounting SSHFS shared folder...
==> default: Mounting folder via SSHFS: E:/Development/applications => /var/www/html
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
Mounting SSHFS shared folder via slave SSHFS mount failed. Please
look at the below STDERR output from the processes that were run.

SSH command:

Warning: Permanently added '192.168.0.103' (ECDSA) to the list of known hosts.
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option


SFTP command:

Can any help me to setup this properly? Why I am missing here?

ReynierPM

Posted 2018-07-01T01:03:38.670

Reputation: 285

Answers

0

While I am unable to check it on Win10 right now, I had a similar problem with Ubuntu 18.4 using VirtualBox on a MacOS host. The error message seems to be related to SSHFS anyway.

Adding the 'nonempty' option to sshfs_opts_append worked for me:

config.vm.synced_folder "../../applications", "/var/www", type: "sshfs", sshfs_opts_append: "-o nonempty -o cache=no"

While trying your configuration there seemed to be a superfluous comma – I had to remove it.

Molotoff

Posted 2018-07-01T01:03:38.670

Reputation: 298