Capistrano Deploy to Multiple Servers 2017-04-15 11:20 am | Comments The key snippet is below: 1 2 3 4 5 6 7 8 9 role :app, %w{xx.xx.xx.xx xx.xx.xx.xx}, user: 'ubuntu', primary: true set :pty, true set :ssh_options, { forward_agent: true, auth_methods: ["publickey"], keys: %w(~/.ssh/id_rsa_jenkins_deploy) } The introduce of pty, and some expression of forward_agent.