Python softlayer api:更改根密码和ssh密钥操作
我是一名开发人员,目前的工作是编写一个脚本来管理softlayer虚拟机。问题在于更改根密码和绑定(删除绑定)SshKey。我的问题是:Python softlayer api:更改根密码和ssh密钥操作,python,api,ibm-cloud-infrastructure,Python,Api,Ibm Cloud Infrastructure,我是一名开发人员,目前的工作是编写一个脚本来管理softlayer虚拟机。问题在于更改根密码和绑定(删除绑定)SshKey。我的问题是: 我有一个正在运行的softlayer虚拟机,wihch softlayer api可以帮助我更改虚拟机的根密码 我有一个正在运行的softlayer vm,它以前没有绑定过sshkey。是否有任何softlayer api可以帮助我将ssh密钥绑定到此vm 与第2点相反,如何使用softlayer api解除sshkey的绑定 关于您的第一个问题,请从vm更改
关于您的第一个问题,请从vm更改root密码,请执行以下步骤: 从vm检索密码的标识符
https://$user:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/$vsiId/getSoftwareComponents?objectMask=mask[passwords]
Method: Get
用您自己的信息替换$user、$apiKey和$vsiId
您将得到如下结果:
hardwareId": null
"id": 345676755
"manufacturerLicenseInstance": "C412F72A-1BB1-4C07-9467-E55729234F8E"
"passwords": [1]
0: {
"createDate": "2016-06-09T11:10:28-03:00"
"id": 122333
"modifyDate": "2016-09-06T11:19:18-03:00"
"password": "Cochabamba"
"port": null
"softwareId": 11209641
"username": "Ruber"
"software": null
}
}
然后,您可以使用以下调用进行更新:
https://$user:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Software_Component_Password/$passwordId/editObject
Method: Post
{
"parameters":[
{
"username":"usernameTest",
"password":"Password*-"
}
]
}
用您自己的信息替换:$user、$apiKey和$passwordId,在这种情况下,$passwordId是:122333
关于第二个和第三个问题,不幸的是,通过SoftLayer API不可能做到这一点,需要重新加载操作系统
哦,是的,的确如此,密码不会更改,只是用于跟踪