Merge pull request #99550 from andyzhangx/fix-win-smb-mount-issue

fix smb mount PermissionDenied issue on Windows
This commit is contained in:
Kubernetes Prow Robot
2021-03-02 23:57:33 -08:00
committed by GitHub

View File

@@ -164,7 +164,7 @@ func newSMBMapping(username, password, remotepath string) (string, error) {
// https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-5.1
cmdLine := `$PWord = ConvertTo-SecureString -String $Env:smbpassword -AsPlainText -Force` +
`;$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Env:smbuser, $PWord` +
`;New-SmbGlobalMapping -RemotePath $Env:smbremotepath -Credential $Credential`
`;New-SmbGlobalMapping -RemotePath $Env:smbremotepath -Credential $Credential -RequirePrivacy $true`
cmd := exec.Command("powershell", "/c", cmdLine)
cmd.Env = append(os.Environ(),
fmt.Sprintf("smbuser=%s", username),