diff --git a/plugins/guests/linux/cap/mount_smb_shared_folder.rb b/plugins/guests/linux/cap/mount_smb_shared_folder.rb index d97e58116..364f9f002 100644 --- a/plugins/guests/linux/cap/mount_smb_shared_folder.rb +++ b/plugins/guests/linux/cap/mount_smb_shared_folder.rb @@ -15,38 +15,21 @@ module VagrantPlugins mount_device = "//#{options[:smb_host]}/#{name}" - mount_options = options.fetch(:mount_options, []) - detected_ids = detect_owner_group_ids(machine, guestpath, mount_options, options) - mount_uid = detected_ids[:uid] - mount_gid = detected_ids[:gid] - + mount_options, _, _ = options[:plugin].capability( + :mount_options, name, expanded_guest_path, options) + mount_type = options[:plugin].capability(:mount_type) # If a domain is provided in the username, separate it username, domain = (options[:smb_username] || '').split('@', 2) smb_password = options[:smb_password] # Ensure password is scrubbed Vagrant::Util::CredentialScrubber.sensitive(smb_password) - mnt_opts = [] - if machine.env.host.capability?(:smb_mount_options) - mnt_opts += machine.env.host.capability(:smb_mount_options) - else - mnt_opts << "sec=ntlmssp" - end - mnt_opts << "credentials=/etc/smb_creds_#{name}" - mnt_opts << "uid=#{mount_uid}" - mnt_opts << "gid=#{mount_gid}" - if !ENV['VAGRANT_DISABLE_SMBMFSYMLINKS'] - mnt_opts << "mfsymlinks" - end - - mnt_opts = merge_mount_options(mnt_opts, options[:mount_options] || []) - - mount_options = "-o #{mnt_opts.join(",")}" + if mount_options.include?("mfsymlinks") display_mfsymlinks_warning(machine.env) end - mount_command = "mount -t cifs #{mount_options} #{mount_device} #{expanded_guest_path}" + mount_command = "mount -t #{mount_type} -o #{mount_options} #{mount_device} #{expanded_guest_path}" # Create the guest path if it doesn't exist machine.communicate.sudo("mkdir -p #{expanded_guest_path}") @@ -82,7 +65,9 @@ SCRIPT ensure # Always remove credentials file after mounting attempts # have been completed - machine.communicate.sudo("rm /etc/smb_creds_#{name}") + if !machine.config.vm.allow_fstab_modification + machine.communicate.sudo("rm /etc/smb_creds_#{name}") + end end emit_upstart_notification(machine, expanded_guest_path)