![](/img/trans.png)
[英]How do I resolve this error when trying to connect to an SQL server hosted on a Google Compute Engine Ubuntu VM
[英]How do I add a SSH key to Google Cloud Compute Engine VM Linux instance?
我有一個在 Google Cloud Platform 中運行的 Linux VM 實例。 我試圖將我的公鑰復制到~/.ssh/authorized_keys
並且我可以成功地通過 SSH 連接到我的 VM。
但有時~/.ssh/authorized_keys
被刷新,我必須再次復制公鑰。 每次添加公鑰真的很痛苦。 如何永久添加公鑰?
您可以通過向 VM 添加 SSH 密鑰來跟蹤元數據管理的 SSH 連接:
要使用 Cloud Console 將公共 SSH 密鑰添加到項目元數據,請執行以下操作:
1. In the Cloud Console, go to the Metadata page.
2. Go to Metadata > Under SSH Keys, click Edit.
3. Click Add item. A text box opens.
4. Add your public key in the text box. The key must be in one of the following formats:
Format for a key without an expiration time:
KEY_VALUE USERNAME
Format for a key with an expiration time:
KEY_VALUE google-ssh {"userName":"USERNAME","expireOn":"EXPIRE_TIME"}
Replace the following:
KEY_VALUE: the public SSH key value
USERNAME: the username for the SSH key, specified when the key was created
EXPIRE_TIME: the time the key expires, in ISO 8601 format. For example: 2021-12-04T20:12:00+0000
5. Click Save.
請注意格式Required format: <protocol> <key-blob> <username@example.com> or <protocol> <key-blob> google-ssh {"userName":"<username@example.com>","expireOn":"<date>"}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.