Closed phox4ever closed 2 years ago
@phox4ever thanks for the report, would you like to contribute this fix?
@swalkinshaw I realized that it probably needs a better solution than just updating the sec parameter. Best would be to provide an option to override the defaults. And it's missing a way to change the smb_host which is very handy if you are switching between LAN & Wi-Fi.
As a workaround I created my own Vagrantfile in the root folder of my project that expands trellis Vagrantfile, because trellis doesn't seem to support a local Vagrantfile. I've also switched to vers=3.0 because I occasionally get weird reading errors from the share in Wordpress, but I don't think this has fixed it though.
trellis_vagrantfile = File.expand_path('../trellis/Vagrantfile', __FILE__)
load trellis_vagrantfile if File.exists?(trellis_vagrantfile)
def mount_options_smb(dmode:, fmode:)
["vers=3.0", "mfsymlinks", "dir_mode=0#{dmode}", "file_mode=0#{fmode}", "sec=ntlmssp"]
end
trellis_config = Trellis::Config.new(root_path: ANSIBLE_PATH)
vconfig = YAML.load_file("#{ANSIBLE_PATH}/vagrant.local.yml")
vagrant_mount_type = vconfig.fetch('vagrant_mount_type')
Vagrant.configure('2') do |config|
if vagrant_mount_type == 'smb'
bin_path = File.join(ANSIBLE_PATH_ON_VM, 'bin')
extra_options = {
smb_username: vconfig.fetch('vagrant_smb_username', 'vagrant'),
smb_password: vconfig.fetch('vagrant_smb_password', 'vagrant'),
smb_host: vconfig.fetch('vagrant_smb_host'),
}
trellis_config.wordpress_sites.each_pair do |name, site|
config.vm.synced_folder local_site_path(site), remote_site_path(name, site), owner: 'vagrant', group: 'www-data', mount_options: mount_options_smb(dmode: 776, fmode: 775), type: vagrant_mount_type, **extra_options
end
config.vm.synced_folder ANSIBLE_PATH, ANSIBLE_PATH_ON_VM, mount_options: mount_options_smb(dmode: 755, fmode: 644), type: vagrant_mount_type, **extra_options
config.vm.synced_folder File.join(ANSIBLE_PATH, 'bin'), bin_path, mount_options: mount_options_smb(dmode: 755, fmode: 755), type: vagrant_mount_type, **extra_options
end
end
I've just removed the whole "sec=ntlmssp" argument and that's what works for me. Also while testing with smb make sure the /srv/www is owned by vagrant and not root, thats what happened to me.
I too get the weird (php) errors, but thats just because the file isn't fully synced with the vm yet.
What VM are you using? Because NFS shares should work better.
Hi guys, any updates regarding this issue? Thanks
Closing this since it's quite old and potentially stale. I'm also not sure if this a Trellis issue or something with Vagrant + VirtualBox (which might have been fixed).
Feel free to comment if there's any new information.
Submit a feature request or bug report
What is the current behavior?
Mounting a share with SMB on Windows 10 from Ubuntu 18.04 using
sec=ntlm
is not possible and results in an error.What is the expected or desired behavior?
Vagrant should be mounting smb shares with
sec=ntlmssp
by default or there should at least be an option to override mount options with a variable in 'vagrant.local.yml'. It's currently hard coded in 'vagrant.rb':Bug report
Please provide steps to reproduce, including full log output:
On a Windows 10 machine set
vagrant_mount_type: 'smb'
& runvagrant.exe up
in WSL bash.Please describe your local environment:
Ansible version: 2.7.8
OS: Windows 10 Version 1803 (OS Build 17134.590) using WSL with vagrant.exe
Vagrant version: 2.2.1
Where did the bug happen? Development or remote servers?
Development