ssh-deploy icon indicating copy to clipboard operation
ssh-deploy copied to clipboard

Warning: Permanently added '***' (ECDSA) to the list of known hosts

Open zhaobinglong opened this issue 4 years ago • 14 comments

2020-10-22T07:41:24.5568739Z [Rsync] Starting Rsync Action: /home/runner/work/oa/oa/dist/ to ***@***:***
2020-10-22T07:41:31.1770919Z ⚠️ [Rsync] error:  rsync exited with code 23
2020-10-22T07:41:31.1773617Z ⚠️ [Rsync] stderr:  Warning: Permanently added '***' (ECDSA) to the list of known hosts.
2020-10-22T07:41:31.1775129Z rsync: chgrp "***/." failed: Operation not permitted (1)
2020-10-22T07:41:31.1776683Z rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]
2020-10-22T07:41:31.1777553Z 
2020-10-22T07:41:31.1778526Z ⚠️ [Rsync] stdout:  sending incremental file list

zhaobinglong avatar Oct 22 '20 08:10 zhaobinglong

need help 2

D45putspin avatar Nov 22 '20 15:11 D45putspin

me too

jakelima18 avatar Dec 10 '20 13:12 jakelima18

and me)

n1k1ta42 avatar Dec 16 '20 07:12 n1k1ta42

As a workaround. You could prepare SSH_HOSTKEY using ssh-keyscan -p <sshport> <hostname> and save it to known_hosts. See an example

      - name: Prepare SSH to work with the remote server
        run: |
          cd ~ && mkdir .ssh &&
          touch ~/.ssh/known_hosts &&
          echo "${{ secrets.SSH_HOSTKEY }}" > ~/.ssh/known_hosts

sergejkaravajnij avatar Dec 23 '20 11:12 sergejkaravajnij

does not work

n1k1ta42 avatar Dec 23 '20 12:12 n1k1ta42

Run rsync --version to confirm rsync was installed on your remote host.And install it if needed.

YunshuaiPeng avatar Jan 08 '21 16:01 YunshuaiPeng

@sergejkaravajnij it doesn't work for us neither, sorry

rrr3da avatar Feb 04 '21 15:02 rrr3da

I wound up using a modified version of @sergejkaravajnij's suggestion (making sure, of course, that the host's IP is saved as a secret in the repo as IP):

      - name: Prepare SSH
        run: >
          cd ~ && mkdir .ssh &&
          touch ~/.ssh/known_hosts &&
          ssh-keyscan -H "$IP" >>~/.ssh/known_hosts
        env:
          IP: ${{ secrets.IP }}

SturmB avatar Feb 22 '21 19:02 SturmB

Make sure REMOTE_USER have all permissions of TARGET.

zhangchen915 avatar Apr 09 '21 11:04 zhangchen915

need help +1

coderlyu avatar Jun 15 '22 01:06 coderlyu

I have a similar problem:

⚠️ [Rsync] error:  rsync exited with code 255
⚠️ [Rsync] stderr:  Warning: Permanently added '[***]:***' (ECDSA) to the list of known hosts.
Permission denied, please try again.
Permission denied, please try again.
***@***: Permission denied (publickey,password).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c([23](https://github.com/ctrlmaniac/larapida-on-django/runs/7752617592?check_suite_focus=true#step:4:24)5) [sender=3.1.3]

⚠️ [Rsync] stdout:  
⚠️ [Rsync] cmd:  rsync /home/runner/work/***-on-django/***-on-django/webapp/ ***@***:/home/REMOTE_USER/ --rsh "ssh -p *** -i /home/runner/.ssh/deploy_key -o StrictHostKeyChecking=no" --recursive --exclude= -rltgoDzvO
 1: 0xa1a640 node::Abort() [/home/runner/runners/2.[29](https://github.com/ctrlmaniac/larapida-on-django/runs/7752617592?check_suite_focus=true#step:4:30)4.0/externals/node12/bin/node]
 2: 0xa90649  [/home/runner/runners/2.294.0/externals/node12/bin/node]
 3: 0xc06599  [/home/runner/runners/2.294.0/externals/node12/bin/node]
 4: 0xc08387 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/home/runner/runners/2.294.0/externals/node12/bin/node]
 5: 0x140dd19  [/home/runner/runners/2.294.0/externals/node12/bin/node]

How should I resolve it?

ctrlmaniac avatar Aug 09 '22 18:08 ctrlmaniac

⚠️ [Rsync] error: rsync exited with code 255 ⚠️ [Rsync] stderr: Warning: Permanently added '[]:' (ECDSA) to the list of known hosts. Permission denied, please try again. Permission denied, please try again. @: Permission denied (publickey,password). rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.3]

⚠️ [Rsync] stdout:
⚠️ [Rsync] cmd: rsync /home/runner/work/-on-django/-on-django/webapp/ @:/home/REMOTE_USER/ --rsh "ssh -p *** -i /home/runner/.ssh/deploy_key -o StrictHostKeyChecking=no" --recursive --exclude= -rltgoDzvO 1: 0xa1a640 node::Abort() [/home/runner/runners/2.294.0/externals/node12/bin/node] 2: 0xa90649 [/home/runner/runners/2.294.0/externals/node12/bin/node] 3: 0xc06599 [/home/runner/runners/2.294.0/externals/node12/bin/node] 4: 0xc08387 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/home/runner/runners/2.294.0/externals/node12/bin/node] 5: 0x140dd19 [/home/runner/runners/2.294.0/externals/node12/bin/node]

mohan-1324 avatar Aug 28 '22 09:08 mohan-1324

help me to resolve this

mohan-1324 avatar Aug 28 '22 09:08 mohan-1324

@mohan-1324 @ctrlmaniac Those aren't similar problems. You're running into code 255 and are getting permission errors with your public key. Most likely not in PEM format. There are several threads with the same error, no need to hijack this one.

I am currently also running into error 23, file or directory not found. I'm going to give @SturmB solution a shot.

MatthewCushing avatar Aug 31 '22 05:08 MatthewCushing

I've added a lot of additional logs for easier debugging. Also added script execution via ssh

env:
  SCRIPT_BEFORE: ls

If script env var is configured, before execution known_hosts are updated same as proposed here, just using REMOTE_HOST instead of IP, since remote host is already available.

Also added full e2e testing. e2e Tests are creating test user and host with docker and then executing this action in real e2e scenario. Check: https://github.com/easingthemes/ssh-deploy/blob/main/.github/workflows/e2e.yml Screenshot 2023-01-03 at 04 01 22

  1. SCRIPT_BEFORE (optional, default '') Script to run on host machine before rsync. Single line or multiline commands. Execution is preformed by storing commands in .sh file and executing it via .bash over ssh

  2. SCRIPT_AFTER (optional, default '') Script to run on host machine after rsync. Rsync output is stored in $RSYNC_STDOUT env variable.

easingthemes avatar Jan 03 '23 03:01 easingthemes

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Feb 03 '23 02:02 github-actions[bot]

image

It works fine after adding SCRIPT_BEFORE: ls (or whoami)

But any idea why the default ssh-keyscan (line 50) fails to begin with? I tested with both ubuntu-22.04 as well as ubuntu-20.04 with similar results.

Any clue whether it has something to do with the GitHub Ubuntu images?

Also is it not possible to use an ed25519 based key with this action?

suhaibkn avatar Feb 04 '23 07:02 suhaibkn

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Mar 07 '23 02:03 github-actions[bot]

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Apr 07 '23 01:04 github-actions[bot]

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar May 08 '23 01:05 github-actions[bot]