【发布时间】:2017-05-13 04:06:18
【问题描述】:
本地计算机用户名:Christopher
Ubuntu 服务器用户名:my_app_name
我已按照 Digital Ocean 文档使用 Ruby on Rails 设置 Ubuntu 16.04 服务器,这是我第一次这样做,但当我到达 cap production deploy:initial 时,即使我能够 ssh,控制台也会返回 Net::SSH::AuthenticationFailed: Authentication failed for user Christopher@12.23.34.45我的 root 和用户帐户没有问题。
我遵循了这些说明:
如何将您的水滴与 Digital Ocean 连接 https://www.digitalocean.com/community/tutorials/how-to-connect-to-your-droplet-with-ssh
使用 Ubuntu 16.04 进行初始服务器设置
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04
我使用以下方法在本地计算机上生成了一个 ssh 公钥/私钥对:
ssh-keygen -t rsa
我将本地计算机中的公钥添加到服务器 ~/.ssh/authorized_keys 文件中。然后我就可以 ssh 进入我的 root 和用户帐户了。
然后我按照以下说明进行操作:
使用 Capistrano、Nginx 和 Puma 在 Ubuntu 14.04 上部署 Rails 应用程序 https://www.digitalocean.com/community/tutorials/deploying-a-rails-app-on-ubuntu-14-04-with-capistrano-nginx-and-puma
我生成了另一个 ssh 密钥,这次是在服务器上,并将公钥添加到我的 github 的部署密钥列表中。然后我就可以通过 ssh 成功克隆我的 repo。
我运行以下命令:
cat ~/.ssh/id_rsa.pub | ssh -p your_port_num deploy@your_server_ip 'cat >> ~/.ssh/authorized_keys'
cap production deploy:initial
然后回来:
Net::SSH::AuthenticationFailed: Authentication failed for user Christopher@12.23.34.45
我非常感谢任何帮助,因为这是我第一次部署到 Ubuntu 服务器,我真的很想知道我做错了什么。提前谢谢你。
【问题讨论】:
标签: ruby-on-rails ubuntu ssh capistrano