appleboy / drone-scp

Copy files and artifacts via SSH using a binary, docker or Drone CI.
MIT License
142 stars 30 forks source link

getKeyFile error: ssh: no key found #132

Open rlintott opened 2 years ago

rlintott commented 2 years ago

I'm using Tekton and trying to scp to a server using the image docker.io/appleboy/drone-scp:latest

  - name: upload-script
    image: docker.io/appleboy/drone-scp:latest #tag: 1.6.1
    script: |

      echo "$(params.SSH_SCRIPT)" > script.sh
      echo "$SSH_PUBLIC_KEY" > ${HOME}/.ssh/id_rsa
      drone-scp --host $(params.HOST) \
        --port $(params.PORT) \
        --username $(params.USERNAME) \
        --key-path "${HOME}/.ssh/id_rsa" \
        --target testing \
        --source script.sh

the ssh key is public. Apparently that might be the issue. Is there a way to connect with a public key? Because the server I want to connect to has the private key But I am getting this output:

tar all files into /tmp/880393127/dUVpoOUcUS.tar
scp file to server.
2022/01/27 21:05:21 getKeyFile error: ssh: no key found
2022/01/27 21:05:25 error copy file to dest: <ip>, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
drone-scp error:  error copy file to dest:  <ip>, error message: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain

Thanks

DrBlury commented 2 years ago

It seems to me that i faced the same issue. So bump! I tried to load the key from an organization secret (not keyfile) - maybe that can help. You can just reply here so I can help troubleshooting.

siwa-pparzer commented 7 months ago

got similar error: getKeyFile error: open /root/.ssh/id_rsa: permission denied worked for years now, suddenly this error occurs