创建及导入SSH密钥对(V2)
功能介绍
创建SSH密钥对,或把公钥导入华为云中,生成SSH密钥对。
创建SSH密钥对成功后,请把响应数据中的私钥内容保存到本地文件,用户使用该私钥登录云服务器。为保证云服务器安全,私钥数据只能下载一次,请妥善保管。
请求消息
创建SSH密钥对时,只需要提交SSH密钥对的name属性。导入SSH密钥对时,才需要提交public_key属性。
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
keypair |
是 |
Object |
创建或导入的SSH密钥对的信息,详情请参见表3。 |
响应消息
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
keypair |
是 |
Object |
SSH密钥对的信息,详情请参见表5。 |
示例
- 创建SSH密钥对
- 创建SSH密钥对请求样例
{ "keypair": { "type": "ssh", "name": "demo" } }
- 创建SSH密钥对响应样例
{ "keypair": { "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyNtFZM04PFxERvZU5OBKTKr3mtRZABe5/+zX81lTgDFCBfq6OXia47M4qXOa3ciBEKKZF+fMfs8U2UNB9aK1R/uORsoEFtxSgZnWG6p4Ct1vnrqwDD934VaDFPEn+h3JeAfvTB+Ag1YQ9zh9uYyE9Z3qZcC9+Ui93BDGdBtQeav4odxdwXcr2mT2jJV0nsocV0O4UcKM8BaIm8eqbcroZEkyxqT3mUoSbmGx1hrngjBsP1ufgwJ6D85LFGQC1SjIOLvsR9i6v41BaLF8/kygvKOh2HlNVSMx38g52sTqoQ/xb3f8vR1VDXliAuD0frrG2Fy5wK4rOAnjuX9nh0bC9 Generated-by-Nova\n", "private_key": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEAsjbRWTNODxcREb2VOTgSkyq95rUWQAXuf/s1/NZU4AxQgX6u\njl4muOzOKlzmt3IgRCimRfnzH7PFNlDQfWitUf7jkbKBBbcUoGZ1huqeArdb566s\nAw/d+FWgxTxJ/odyXgH70wfgINWEPc4fbmMhPWd6mXAvflIvdwQxnQbUHmr+KHcX\ncF3K9pk9oy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EQ8CgYEAwELzW6oaAzR+dfk428p0UB4W0HkXAy0a9efS\nUgpc8Oag6qF09SRGjdunshySQvegU78MCPtjVxUntE7dk0OD+di213SBn3jawAHG\niHORjtkDndIPfCwcUdnpK0GAVtL6kK2dlIIZa9TB15WnT07Pzry4w21WkYSJ3Thf\neJyNzYMCgYA8OvpKMdaEXFeNZWHDE1Q2VmpxvP/D6u6s4SBuyy8eac1qqku/s7zc\nsuFd/o9wbBgzsf4eN8tNJ4bxrArRXvf9WyH7xd4PE3DvVJnz5S+8Nqj2Z0KCAqPD\nibDbFxBYHcMIdwC2JBGQZIXpkST2jG9wZho5KghX4yiHSOPr2V25/g==\n-----END RSA PRIVATE KEY-----\n", "user_id": "6fc0d2cbbfab40b199874b97097e913d", "name": "demo", "fingerprint": "b4:9a:c3:12:c4:90:bf:8e:7a:e2:70:10:c3:00:55:3f" } }
- 创建SSH密钥对请求样例
- 导入SSH密钥对
- 导入SSH密钥对请求样例
{ "keypair": { "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyNtFZM04PFxERvZU5OBKTKr3mtRZABe5/+zX81lTgDFCBfq6OXia47M4qXOa3ciBEKKZF+fMfs8U2UNB9aK1R/uORsoEFtxSgZnWG6p4Ct1vnrqwDD934VaDFPEn+h3JeAfvTB+Ag1YQ9zh9uYyE9Z3qZcC9+Ui93BDGdBtQeav4odxdwXcr2mT2jJV0nsocV0O4UcKM8BaIm8eqbcroZEkyxqT3mUoSbmGx1hrngjBsP1ufgwJ6D85LFGQC1SjIOLvsR9i6v41BaLF8/kygvKOh2HlNVSMx38g52sTqoQ/xb3f8vR1VDXliAuD0frrG2Fy5wK4rOAnjuX9nh0bC9 Generated-by-Nova\n", "type": "ssh", "name": "demo1", "user_id": "fake" } }
- 导入SSH密钥对响应样例
{ "keypair": { "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyNtFZM04PFxERvZU5OBKTKr3mtRZABe5/+zX81lTgDFCBfq6OXia47M4qXOa3ciBEKKZF+fMfs8U2UNB9aK1R/uORsoEFtxSgZnWG6p4Ct1vnrqwDD934VaDFPEn+h3JeAfvTB+Ag1YQ9zh9uYyE9Z3qZcC9+Ui93BDGdBtQeav4odxdwXcr2mT2jJV0nsocV0O4UcKM8BaIm8eqbcroZEkyxqT3mUoSbmGx1hrngjBsP1ufgwJ6D85LFGQC1SjIOLvsR9i6v41BaLF8/kygvKOh2HlNVSMx38g52sTqoQ/xb3f8vR1VDXliAuD0frrG2Fy5wK4rOAnjuX9nh0bC9 Generated-by-Nova\n", "user_id": "6fc0d2cbbfab40b199874b97097e913d", "name": "demo1", "fingerprint": "b4:9a:c3:12:c4:90:bf:8e:7a:e2:70:10:c3:00:55:3f" } }
- 导入SSH密钥对请求样例
状态码
请参考状态码。