skip to Main Content

I have a rails app that I could so far successfully deploy to my Ubuntu server using capistrano 3.

Last night I did a successful server update using do-release-upgrade:

Linux my-server 5.15.0-47-generic #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

I can still ssh into the server using my id_rsa key from my Mac Terminal:

ssh [email protected]
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-47-generic x86_64)

However Capistrano now asks for the password instead of asking me for the passkey of my id_rsa certificate:

cap production deploy
[email protected]'s password:

I tried to run ssh-copy-id too to make sure the certificate is re-uploaded:

ssh-copy-id [email protected]     
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system.
                (if you think this is a mistake, you may want to use -f option)

It’s all quite weird since just yesterday I did do several deployments:

ls -lia rails/releases/ | grep 20220913 | wc -l
9

I did not enable passwords for the SSH access at all so I am wondering how to re-enable the SSH communication with my sever.

Update

The issue might be related to "SSH agent forwarding". I did use capistrano-ssh-doctor and it told me that:

SSH agent forwarding report

  1. [success] repo_url setting ok

  2. [success] ssh private key file exists

  3. [success] ssh-agent process seems to be running locally

  4. [success] ssh-agent process recognized by ssh-add command

  5. [success] ssh private keys added to ssh-agent

  6. [success] application repository accessible from local machine

  7. [success] all hosts using passwordless login

  8. [success] forward_agent ok for all hosts

  9. [success] ssh agent successfully forwarded to remote hosts

  10. [error] It seems Capistrano cannot access application git repository from these hosts: my-server.example.com
    Actions:

  • make sure all the previous checks pass. That should make this one work too.

It seems SSH agent forwarding is not set up correctly. Follow the
suggested steps described in error messages. Errors (if more than one)
are ordered by importance, so always start with the first one.

So I logged in on the server and I was able to successfully clone the repository.

There is some information in this post:

I’d still like to find out why I can’t use the [email protected]:{github-organization}/{private-repo}.git format for :repo_url, with keys, when all of the SSH forwarding report’s requirements seem to be met. If you need further info from me just let me know – and thanks again for any help!

So it seems that the :repo_url needs to be changed. I’ll give that a shot.

2

Answers


  1. Chosen as BEST ANSWER

    I did figure out that now for some reason the following command does no longer work:

    cap staging deploy
    

    Instead I need to use bundler

    bundle exec cap staging deploy
    

  2. Had the same issue. This fixed it for me: https://askubuntu.com/questions/1409105/ubuntu-22-04-ssh-the-rsa-key-isnt-working-since-upgrading-from-20-04

    Add this to the end of /etc/ssh/sshd_config:

    PubkeyAcceptedKeyTypes +ssh-rsa
    HostKeyAlgorithms +ssh-rsa
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search