From 41939399d78940bcd3cfdf10afa6b3aed051758c Mon Sep 17 00:00:00 2001 From: ioito Date: Thu, 25 Apr 2019 16:35:35 +0800 Subject: [PATCH] =?UTF-8?q?Azure:=20=E4=BF=AE=E5=A4=8D=E8=99=9A=E6=8B=9F?= =?UTF-8?q?=E6=9C=BA=E6=97=B6=E6=9C=AA=E8=AE=BE=E7=BD=AEkeypair=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/util/azure/host.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/util/azure/host.go b/pkg/util/azure/host.go index 956f1b76e9..fa963f4b6e 100644 --- a/pkg/util/azure/host.go +++ b/pkg/util/azure/host.go @@ -182,12 +182,15 @@ func (self *SHost) _createVM(desc *cloudprovider.SManagedVMCreateConfig, nicId s }, Type: "Microsoft.Compute/virtualMachines", } - if len(desc.PublicKey) > 0 { + if len(desc.PublicKey) > 0 && desc.OsType == osprofile.OS_TYPE_LINUX { instance.Properties.OsProfile.LinuxConfiguration = &LinuxConfiguration{ DisablePasswordAuthentication: false, SSH: &SSHConfiguration{ PublicKeys: []SSHPublicKey{ - {KeyData: desc.PublicKey}, + { + KeyData: desc.PublicKey, + Path: fmt.Sprintf("/home/%s/.ssh/authorized_keys", api.VM_AZURE_DEFAULT_LOGIN_USER), + }, }, }, }