ssh - 即使使用 json 密钥文件进行身份验证,gcloud compute ssh 也需要密码
问题描述
我正在尝试使用 json 密钥对 gcloud 进行身份验证,甚至在运行时按照密码所需的文档执行所有操作gcloud compute ssh root@production
这是我执行的步骤的快照。
1. 使用服务帐号授权访问谷歌云平台
tahir@NX00510:~/www/helloworld$ gcloud auth activate-service-account 1055703200677-compute@developer.gserviceaccount.com --key-file=gcloud_key.json
Activated service account credentials for: [1055703200677-compute@developer.gserviceaccount.com]
2.初始化gcloud
tahir@NX00510:~/www/helloworld$ gcloud init
Welcome! This command will take you through the configuration of gcloud.
Settings from your current configuration [default] are:
compute:
region: us-central1
zone: us-central1-b
core:
account: 1055703200677-compute@developer.gserviceaccount.com
disable_usage_reporting: 'True'
project: concise-hello-122320
Pick configuration to use:
[1] Re-initialize this configuration [default] with new settings
[2] Create a new configuration
Please enter your numeric choice: 1
Your current configuration has been set to: [default]
You can skip diagnostics next time by using the following flag:
gcloud init --skip-diagnostics
Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).
Choose the account you would like to use to perform operations for
this configuration:
[1] 1055703200677-compute@developer.gserviceaccount.com
[2] Log in with a new account
Please enter your numeric choice: 1
You are logged in as: [1055703200677-compute@developer.gserviceaccount.com].
API [cloudresourcemanager.googleapis.com] not enabled on project
[1055703200677]. Would you like to enable and retry (this will take a
few minutes)? (y/N)? N
WARNING: Listing available projects failed: PERMISSION_DENIED: Cloud Resource Manager API has not been used in project 1055703200677 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/overview?project=1055703200677 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
- '@type': type.googleapis.com/google.rpc.Help
links:
- description: Google developers console API activation
url: https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/overview?project=1055703200677
Enter project id you would like to use: concise-hello-122320
Your current project has been set to: [concise-hello-122320].
Do you want to configure a default Compute Region and Zone? (Y/n)? n
Your Google Cloud SDK is configured and ready to use!
* Commands that require authentication will use 1055703200677-compute@developer.gserviceaccount.com by default
* Commands will reference project `concise-hello-122320` by default
Run `gcloud help config` to learn how to change individual settings
This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.
Some things to try next:
* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the SDK like arg files and output formatting
3. SSH 到 gcloud
tahir@NX00510:~/www/helloworld$ gcloud compute ssh root@production
No zone specified. Using zone [us-central1-b] for instance: [production].
root@compute.1487950061407628967's password:
我不知道我应该在这里输入哪个密码,而且我相信它不应该首先要求输入密码,因为我使用了 json 密钥文件进行身份验证。
你们能帮我解决这个问题吗?
谢谢 !
解决方案
推荐阅读
- python - 如何将宽吻 Python 库与 MWS 一起使用
- c# - 反方向跑?
- composer-php - 如何在 laravel 5.6 中正确升级引导程序?
- firebase - 在 CLI 中成功将云功能部署到 firebase,但仪表板中没有出现
- npm - 未满足和不正确的对等依赖之间有什么区别?
- oracle-sqldeveloper - oracle sqldeveloper 不显示对象计数
- ios - 使用指向对象上的 wherekey 解析查询
- sql - SQL:不工作时的情况
- c# - AutoMapper 和手动映射嵌套的复杂类型
- google-chrome-extension - 在 Chrome 扩展程序中使用 Google 帐户进行服务器端身份验证