SSH key don't login

#1

I use RSA key that I added in Circle CI web app. On deploy job I add key, output is “Installed key d6:75:b5…” but when I’m try to copy files by scp i get

Warning: Permanently added '[s11.vdl.pl]:59184,[46.4.105.132]:59184' (RSA) to the list of known hosts.
xxx@s11.vdl.pl's password: 
Too long with no output (exceeded 10m0s)

This is my deploy job

deploy:
machine:
  enabled: true
steps:
  - add_ssh_keys
  - attach_workspace:
      at: public
  - run:
      name: check files
      command: |
        pwd && ls -al
  - run:
      name: Deploy Over SSH
      command: |
        scp -P $SSH_PORT -r ~/project/public/ $SSH_USER@$SSH_HOST:$SSH_PATH
#2

I assume this key is added to the ~/.ssh/authorized_keys file on your server, but it looks like the server is ignoring the key and try to fallback to user/pass login.

I would suggest running an SSH job https://circleci.com/docs/2.0/ssh-access-jobs/ so you can check the files and troubleshoot, it makes things a lot easier.

#3

I want to figure out what is wrong without SSH job :slight_smile:
When i run command

#!/bin/bash -eo pipefail
ls -la ~/.ssh/ && cat ~/.ssh/config && cat authorized_keys && cat config
total 20
drwx------  2 circleci circleci 4096 Mar 18 15:54 .
drwxr-xr-x 16 circleci circleci 4096 Mar 18 15:54 ..
-rw-r--r--  1 root     root      214 Mar 18 15:54 authorized_keys
-rw-rw-r--  1 circleci circleci  112 Mar 18 15:54 config
-rw-------  1 circleci circleci 1679 Mar 18 15:54 id_rsa_d675b5f987835b0ac2d588e7d845bb06
Host s78.vdl.pl
IdentitiesOnly yes
IdentityFile /home/circleci/.ssh/id_rsa_d675b5f987835b0ac2d588e7d845bb06
cat: authorized_keys: No such file or directory
Exited with code 1  

I see the files when I’m listing them but can’t enter them id_rsa_d675… also don’t run. Maybe I should copy somehow this keys?

I must do something more than paste private ssh key in to Circle CI settings?

#4

No, that should be all that is needed. Did you double-check you are able to login to your server outside on CircleCI using this key?