diff --git a/plugins/synced_folders/smb/errors.rb b/plugins/synced_folders/smb/errors.rb index b9923774c..697829833 100644 --- a/plugins/synced_folders/smb/errors.rb +++ b/plugins/synced_folders/smb/errors.rb @@ -21,6 +21,10 @@ module VagrantPlugins class WindowsHostRequired < SMBError error_key(:windows_host_required) end + + class WindowsAdminRequired < SMBError + error_key(:windows_admin_required) + end end end end diff --git a/plugins/synced_folders/smb/synced_folder.rb b/plugins/synced_folders/smb/synced_folder.rb index c843c6b30..df3bab2a2 100644 --- a/plugins/synced_folders/smb/synced_folder.rb +++ b/plugins/synced_folders/smb/synced_folder.rb @@ -20,6 +20,11 @@ module VagrantPlugins return false end + if !Vagrant::Util::Platform.windows_admin? + raise Errors::WindowsAdminRequired if raise_error + return false + end + true end diff --git a/templates/locales/synced_folder_smb.yml b/templates/locales/synced_folder_smb.yml index 509772a57..c3ce974fa 100644 --- a/templates/locales/synced_folder_smb.yml +++ b/templates/locales/synced_folder_smb.yml @@ -37,6 +37,11 @@ en: Error: %{stderr} + windows_admin_required: |- + SMB shared folders require running Vagrant with administrative + privileges. This is a limitation of Windows, since creating new + network shares requires admin privileges. Please try again in a + console with proper permissions or use another synced folder type. windows_host_required: |- SMB shared folders are only available when Vagrant is running on Windows. The guest machine can be running non-Windows. Please use