Private and Public SSH Keys for Capistrano on Windows
If you’re deploying a Ruby on Rails application using Capistrano on Windows, and need SSH authentication, you might run into errors like:
connection failed for: xxx.xxx.xxx.xxx (OpenSSL::PKey::PKeyError: not a private key (C:\path\to\key))
or
connection failed for: xxx.xxx.xxx.xxx (OpenSSL::PKey::PKeyError: not a public key “C:\path\to\key.pub”)
This is because Capistrano (by default) does not like the keys generated by Putty. You can get your keys working with Capistrano by converting them to OpenSSH keys using the following steps:
- Load your existing private.ppk private key file into PuTTy Key Generator by clicking the Load button.
- In the Conversions menu, select “Export OpenSSH key”. This will give you an OpenSSH private key that Capistrano accepts.
- Copy and paste the public key contents provided for you in the box under “Public-key for pasting into OpenSSH authorized_keys file:”. Save this in a file of the same name with .pub appended to the end.
Once you do this, you should have OpenSSH public and private keys that Capistrano will accept, and you can still use the old key files for PuTTy.


Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)