Virtualbox

新的 Vagrant Packaged Windows Server 2016 返回身份驗證失敗。重試

  • March 26, 2017

我正在使用 Windows Server 2016 創建一個基本映像。該映像已完全修補並應用了所有正常配置,但是當我對其進行測試時,它無法以 vagrant 使用者身份連接,並帶有一條來自 Google 搜尋的消息,暗示它正在嘗試使用 SSH,儘管對話框中列出了 WinRM。

我已將建構文件放在github中以供參考。

vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'WindowsDocker'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: temp_default_1489982222856_48671
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
   default: Adapter 1: nat
==> default: Forwarding ports...
   default: 5985 (guest) => 55985 (host) (adapter 1)
   default: 5986 (guest) => 55986 (host) (adapter 1)
   default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
   default: WinRM address: 127.0.0.1:55985
   default: WinRM username: vagrant
   default: WinRM execution_time_limit: PT2H
   default: WinRM transport: negotiate
   default: Warning: Authentication failure. Retrying...
   default: Warning: Authentication failure. Retrying...
   default: Warning: Authentication failure. Retrying...

注意:一旦盒子啟動,我可以手動連接到使用 WinRM 嗎?

$securePassword = ConvertTo-SecureString 'vagrant' -asplaintext -force
$cred = New-Object System.Management.Automation.PSCredential ('vagrant', $securePassword)
enter-pssession 127.0.0.1 -port 55985 -Auth CredSSP -credential $cred
[127.0.0.1]: PS C:\Users\vagrant\Documents> exit

平台詳情

  • 主機是 Windows 10
  • 流浪者版本是 1.9.2
  • 甲骨文虛擬機 5.1.18
  • 來賓是 Windows Server 2016 標準評估

注意:在 Vagrant 1.9.1 中,來賓被摧毀了…

   default: WinRM transport: negotiate
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
C:/HashiCorp/Vagrant/embedded/gems/gems/winrm-1.8.1/lib/winrm/http/response_handler.rb:57:in `raise_if_auth_error': WinRM::WinRMAuthorizationError (WinRM::WinRMAuthorizationError)

所以事實證明我沒有禁用使用者帳戶控制 (UAC),我已將以下內容添加到我的工作表中。

reg add HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /d 0 /t REG_DWORD /f /reg:64

引用自:https://serverfault.com/questions/839324