gpt4 book ai didi

azure - 使用 Capistrano 通过 SSH 访问 Azure for Rails 部署

转载 作者:行者123 更新时间:2023-12-03 04:34:16 25 4
gpt4 key购买 nike

我正在尝试使用 Capistrano 将 Rails 网站部署到 Azure VM。为此,我需要设置 SSH key 。目前我可以在使用此功能时连接到虚拟机:

ssh -i ./mykey.key <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f5988c80869087b5988c869c8190db96999a8091948585db9b9081" rel="noreferrer noopener nofollow">[email protected]</a> -p22

但是当尝试像这样连接时(Capistrano 会这样做:

ssh <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b1dcc8c4c2d4c3f1dcc8c2d8c5d49fd2dddec4d5d0c1c19fdfd4c5" rel="noreferrer noopener nofollow">[email protected]</a>

它拒绝访问:权限被拒绝(公钥)。。我需要做什么才能使这项工作成功?我假设我需要将 SSH key 添加到 Azure,但它似乎不能像这样工作,例如Github 允许添加 SSH key 吗?

最佳答案

您可以为 Azure 生成相同的 key 。OpenSSH 私钥可由 openssl 实用程序直接读取。以下命令将采用现有的 SSH 私钥(以下示例中的 id_rsa)并创建 Azure 所需的 .pem 公钥:

# openssl req -x509 -key ~/.ssh/id_rsa -nodes -days 365 -newkey rsa:2048 -out myCert.pem

myCert.pem 文件是公钥,可用于在 Azure 上配置 Linux 虚拟机。在配置期间,.pem 文件将被转换为 openssh 兼容的公钥并放置在 ~/.ssh/authorized_keys 中。

配置虚拟机后,您可以通过运行以下命令获取 SSH 端点:

azure vm endpoint list <vm-name>  

您可以在 using SSH with Linux on Azure 上阅读更多内容

此外,这是关于 How to deploy a Ruby on Rails Web application to a Windows Azure VM using Capistrano 的帖子

关于azure - 使用 Capistrano 通过 SSH 访问 Azure for Rails 部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29844010/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com