簡體   English   中英

Capistrano 3 要求 SSH 用戶密碼,因為在 Ubuntu 20.04 服務器上完成了“do-release-upgrade”

[英]Capistrano 3 asks for SSH user's password since `do-release-upgrade` was done on Ubuntu 20.04 server

我有一個 Rails 應用程序,到目前為止我可以使用 capistrano 3 成功部署到我的 Ubuntu 服務器。

昨晚我使用do-release-upgrade成功更新了服務器:

Linux my-server 5.15.0-47-generic #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

我仍然可以使用我的 Mac 終端中的id_rsa密鑰ssh進入服務器:

ssh user@my-server.example.com
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-47-generic x86_64)

然而 Capistrano 現在要求輸入密碼,而不是要求我輸入id_rsa證書的密碼:

cap production deploy
user@my-server.example.com's password:

我也嘗試運行ssh-copy-id以確保重新上傳證書:

ssh-copy-id user@my-server.example.com     
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system.
                (if you think this is a mistake, you may want to use -f option)

這一切都很奇怪,因為就在昨天我確實做了幾個部署:

ls -lia rails/releases/ | grep 20220913 | wc -l
9

我根本沒有啟用 SSH 訪問的密碼,所以我想知道如何重新啟用 SSH 與我的服務器的通信。

更新

該問題可能與“SSH 代理轉發”有關。 我確實使用了capistrano-ssh-doctor ,它告訴我:

SSH 代理轉發報告

  1. [成功] repo_url設置成功

  2. [成功] ssh 私鑰文件存在

  3. [成功] ssh-agent進程似乎在本地運行

  4. [成功] ssh ssh-add ssh-agent進程

  5. [成功] ssh 私鑰添加到ssh-agent

  6. [成功] 可從本地計算機訪問的應用程序存儲庫

  7. [成功] 所有主機使用無密碼登錄

  8. [成功] 所有主機都可以使用forward_agent

  9. [成功] ssh 代理成功轉發到遠程主機

  10. [錯誤] Capistrano 似乎無法從這些主機訪問應用程序 git 存儲庫:my-server.example.com 操作:

  • 確保所有先前的檢查都通過。 這也應該使這個工作。

似乎 SSH 代理轉發設置不正確。 按照錯誤消息中描述的建議步驟進行操作。 錯誤(如果不止一個)按重要性排序,所以總是從第一個開始。

因此,我登錄了服務器,並且能夠成功克隆存儲庫。

這篇文章中有一些信息:

I'd still like to find out why I can't use the git@github.com:{github-organization}/{private-repo}.git format for :repo_url , with keys, when all of the SSH forwarding report's requirements似乎遇到了。 如果您需要我提供更多信息,請告訴我 - 再次感謝您的幫助!

所以似乎需要更改:repo_url 我會試一試。

我確實發現現在由於某種原因以下命令不再起作用:

cap staging deploy

相反,我需要使用捆綁器

bundle exec cap staging deploy

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM