appleboy / scp-action

GitHub Action that copy files and artifacts via SSH.
https://github.com/marketplace/actions/scp-command-to-transfer-files
MIT License
1.22k stars 136 forks source link

Action works fine, but still getting a "connection refused" #152

Closed C0ntroller closed 9 months ago

C0ntroller commented 9 months ago

Hi,

I just tried to use your action but ran into a weird issue.

The log says:

tar all files into /tmp/cviVHRTWNY.tar.gz
scp file to server.
create folder /var/www/website/astro
untar file cviVHRTWNY.tar.gz
remove file cviVHRTWNY.tar.gz
drone-scp error:  dial tcp <ip-address>:22: connect: connection refused
drone-scp rollback: remove all target tmp file
remove file cviVHRTWNY.tar.gz
2023/12/14 15:12:54 dial tcp <ip-address>:22: connect: connection refused

So it seems like deleting the temporary file failed 2 times - initially and when you try to rollback.

My config is the following:

    - name: Copy files via ssh
      uses: appleboy/scp-action@v0.1.4
      with:
        host: c0ntroller.de
        username: ${{ secrets.SSH_USERNAME }}
        key: ${{ secrets.SSH_KEY }}
        source: "dist/*"
        target: "/var/www/website/astro"
        overwrite: true
        strip_components: 1

All the files were copied, and even the temporary file was deleted. The SSH-log also shows no connection refused either. So it seems like everything actually works perfectly, but the action just logs an error and the pipeline won't finish correctly.

Any help?

c13 commented 9 months ago

It seems duplicated to #52

Please remove LIMIT rules for ssh protocol sudo ufw status sudo ufw delete NUM_OF_LIMIT_RULE

C0ntroller commented 9 months ago

Thank you, that fixed the issue.

As maybe someone will come here in future:
You should also check that when you delete the rule, ufw might not allow any more ssh-connections. But you can just write sudo ufw allow 22 (22 being the ssh port) and it should replace the limit rule (at least did it in my case).