试图从头开始测试Capistrano.
Capfile:
require 'capistrano/setup' require 'capistrano/deploy' I18n.enforce_available_locales = false Dir.glob('lib/capistrano/tasks/*.rb').each { |r| import r }
deploy.rb:
role :testrole, 'x.x.x.x' set :user, 'ubuntu'
test.rb任务:
namespace :test do desc "Uptime on servers" task :uptime do on roles(:testrole) do execute "uptime" end end end
cap命令:
cap production test:uptime
输出:
INFO [c077da7f] Running /usr/bin/env uptime on x.x.x.x DEBUG [c077da7f] Command: /usr/bin/env uptime cap aborted! Net::SSH::AuthenticationFailed
使用相同的用户和密钥从shell登录时没有问题.登录远程服务器后,我可以在auth.log中看到执行上限时给出的空用户:
test-srv sshd[1459]: Invalid user from x.x.x.x
我错过了什么?谢谢!