Search code examples
capistranossh-keyscapifony

Capifony error during deployment (OpenSSL::PKey::PKeyError: not a public key "/var/www/.ssh/id_rsa.pub")


I keep getting this error (OpenSSL::PKey::PKeyError: not a public key "/var/www/.ssh/id_rsa.pub")

Thanks in advance.

My deploy.rb looks like this:

  set :application, "goom"
    set :domain,      "[email protected]"
    set :deploy_to,   "/var/www/goom"
    #set :app_path,    "app"

    set :repository,  "/var/www/goom/.git"
    set :scm,         :git
    set :deploy_via,  :copy
    # Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, $

    set :model_manager, "doctrine"
    # Or: `propel`

    role :web,        domain                         # Your HTTP server, Apache/etc
    role :app,        domain                         # This may be the same as your$
    role :db,         domain, :primary => true       # This is where Rails migratio$

Solution

  • It turnes out that it is a format issue. Originally my public key had the following format:

    ---- BEGIN SSH2 PUBLIC KEY ----
    Comment: "rsa-key-20101206"
    AAAAB3NzaC1yc2EAAAABJQAAAQB80B66jlf+Xo3E0d6TJdojKB1mkblUCjyCaOA1
    p2GpvQr+TjtCugdmh9069ybWcJCaRcvJu12pz/0iO8H0Ar/f3AiULaj6VHF9rdkA
    qp+k+Ih0ep204VENqgobGfDOKfBcd2o9P1zdbCuie28tGSxoQMZNVVPMXPgl80HQ
    v8+dqL4YDEvsViOMa/A1pxlvw74XwU6jzaVM+4u2ysKu0xEJzSUR4wT4s7f0zr3G
    FNZDlj0vmuyggo9/3BIgtAQC9IcALqT5Jf3V5iN03+8uPUJVuy+XvIJoZJo5fnrT
    zXzDBdUmjJNt+zTYsX3/fHQZOxokHPiBQQ5OTL+NW1Uscukv
    ---- END SSH2 PUBLIC KEY ----
    

    Reformatting it to the following did the trick:

    ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQB80B66jlf+Xo3E0d6TJdojKB1mkblUCjyCaOA1p2GpvQr+TjtCugdmh9069ybWcJCaRcvJu12pz/0iO8H0Ar/f3AiULaj6VHF9rdkAqp+k+Ih0ep204VENqgobGfDOKfBcd2o9P1zdbCuie28tGSxoQMZNVVPMXPgl80HQv8+dqL4YDEvsViOMa/A1pxlvw74XwU6jzaVM+4u2ysKu0xEJzSUR4wT4s7f0zr3GFNZDlj0vmuyggo9/3BIgtAQC9IcALqT5Jf3V5iN03+8uPUJVuy+XvIJoZJo5fnrTzXzDBdUmjJNt+zTYsX3/fHQZOxokHPiBQQ5OTL+NW1Uscukv