28

We have a EC2 instance, and our capistrano setup requires ssh. To connect through ssh normally, I use a .pem file for connecting to the server. how do I utilize this .pem file when using capistrano to deploy?

Tyler Jones
  • 1,283
  • 4
  • 18
  • 38

2 Answers2

39

for capistrano 3 the syntax is somewhat different

set :pty, true

set :ssh_options, {
  forward_agent: true,
  auth_methods: ["publickey"],
  keys: ["/path/to/key.pem"]
}
Kinjal Dixit
  • 7,777
  • 2
  • 59
  • 68
37

In deploy.rb set these configuration values:

default_run_options[:pty] = true
ssh_options[:forward_agent] = true
ssh_options[:auth_methods] = ["publickey"]
ssh_options[:keys] = ["/path/to/key.pem"]

For Capistrano 3 use:

set :pty, true
set :ssh_options, {
  forward_agent: true,
  auth_methods: %w[publickey],
  keys: %w[/path/to/key.pem]
}
NARKOZ
  • 27,203
  • 7
  • 68
  • 90