【发布时间】:2021-05-05 14:03:19
【问题描述】:
我正在尝试在使用 azure nextgen Pulumi api 创建的虚拟机中创建和 ssh。我正在运行 Window 10。
成功创建 VM 后,出于测试目的,我将私钥导出到文件,减少权限以避免“权限太开放”错误,然后运行 ssh user@ip -i keyfile.rsa。但是,我收到错误:Load key ... invalid format.
相关脚本如下:
const rsaKey = new tls.PrivateKey("rsaKey", {
algorithm: "RSA",
});
const vm = new azure_nextgen.compute.latest.VirtualMachine("vm", {
location: resourceGroup.location,
resourceGroupName: resourceGroup.name,
vmName: "linuxvm",
hardwareProfile: {
vmSize: "Standard_B1ms", // may go up to standard b2ms
},
networkProfile: {
networkInterfaces: [{
id: networkInterface.id,
}]
},
osProfile: {
adminUsername: vmUser,
computerName: "test-vm",
linuxConfiguration: {
disablePasswordAuthentication: true,
ssh: {
publicKeys: [{
keyData: rsaKey.publicKeyOpenssh,
path: "/home/*username*/.ssh/authorized_keys",
}]
}
}
},
storageProfile: {
imageReference: {
offer: "UbuntuServer",
publisher: "Canonical",
sku: "18.04-LTS",
version: "latest",
},
osDisk: {
caching: "ReadWrite",
createOption: "FromImage",
managedDisk: {
storageAccountType: "Standard_LRS",
},
name: "myVMosdisk",
},
}
})
我
【问题讨论】:
标签: typescript azure ssh pulumi