1

我正在尝试使用 capistrano 部署我的 rails 应用程序,并且在命令后出现以下错误:

cap production deploy

输出:

DEBUG[a3e9636c] Running /usr/bin/env [ -d ~/.rvm ] on handco-op.com
DEBUG[a3e9636c] Command: [ -d ~/.rvm ]
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host appname.com: Authentication failed for user deploy@appname.com
/home/deploy/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh.rb:219:in `start'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:179:in `with_ssh'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:62:in `test'
/home/deploy/.rvm/gems/ruby-2.1.2/bundler/gems/rvm-dc35ec5e7a74/lib/capistrano/tasks/rvm.rake:19:in `block (3 levels) in <top (required)>'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Net::SSH::AuthenticationFailed: Authentication failed for user deploy@appname.com
/home/deploy/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh.rb:219:in `start'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `call'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:50:in `create_new_entry'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/connection_pool.rb:22:in `checkout'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:179:in `with_ssh'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:62:in `test'
/home/deploy/.rvm/gems/ruby-2.1.2/bundler/gems/rvm-dc35ec5e7a74/lib/capistrano/tasks/rvm.rake:19:in `block (3 levels) in <top (required)>'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/home/deploy/.rvm/gems/ruby-2.1.2/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => rvm:hook
(See full trace by running task with --trace)

为了清楚起见,我用“appname”替换了我的真实服务器名称以保密;)感谢您的任何建议!我希望这是一个简单的修复,我也会继续调查错误。

4

1 回答 1

1

我丢失了密钥,不得不设置 nopassword ssh 和许多其他的调整。这是一个很难修复的错误,需要做很多事情才能解决。调试和修复我的权限大约需要三个小时。一些设置这个的教程实际上可能会搞砸一些事情,例如在 sudo 组中设置用户真的很难直接定义用户: visudo 我建议不要通过以下方式向 sudo 组添加任何内容:

sudo adduser user sudo

这只是我的设置,因此您可能需要向 sudo 添加用户,但我更喜欢在 visudo 中为我的用户授予所有权限:

visudo

user ALL = NOPASSWD:

希望这个人能解决这个问题!这是一个很难解决的错误,发生了很多事情,并且主要是我在配置 capistrano 时的用户错误。祝你好运!保持冷静并继续编码!;)

于 2014-08-09T18:10:16.643 回答