簡體   English   中英

Capistrano:用戶 ubuntu@xx.xxx.xxx.xxx 的身份驗證失敗(Net::SSH::AuthenticationFailed)

[英]Capistrano: Authentication failed for user ubuntu@xx.xxx.xxx.xxx (Net::SSH::AuthenticationFailed)

我可以通過ssh ubuntu@xx.xxx.xxx.xxx連接。 但不是通過cap production deploy:check

當前的

set :user, "ubuntu"
set :ssh_options, { forward_agent: true }

server "xx.xxx.xxx.xxx",
       user: fetch(:user),
       roles: %w[web app db]

試過了

set :user, "ubuntu"
set :ssh_options, {
  forward_agent: true,
  user: fetch(:user),
  keys: %w(~/.ssh/id_rsa)
}

server "xx.xxx.xxx.xxx",
       user: fetch(:user),
       roles: %w[web app db]

“當前”曾經是我為其他項目設置的,我只需要ssh-add然后cap production deploy

發生了什么變化? 還是我的配置不正確?

問題:通過 capistrano 對用戶 ubuntu@xx.xxx.xxx.xxx (Net::SSH::AuthenticationFailed) 進行身份驗證失敗,但可以直接 ssh

調試:

  • sudo tail -f /var/log/auth.log在服務器上
  • 然后嘗試cap production deploy:check我的本地
  • userauth_pubkey:來自auth.log userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]

解決方案:

  • 然后編輯/etc/ssh/sshd_config
    • 找到PubkeyAuthentication然后取消注釋(刪除#
    • 添加PubkeyAcceptedKeyTypes=+ssh-rsa
  • 重啟 sshd sudo systemctl restart sshd

暫無
暫無

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

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