Github action to connect via SSH

I try to use github actions (appleboy/ssh-action) to connect via SSH to a Linode of mine.
This is how the workflow file looks like.

name: Connect to Linode

    branches: [master]

    runs-on: ubuntu-latest
      - uses: actions/checkout@v2
      - name: ls of linode container
        uses: appleboy/ssh-action@master
          host: ${{ secrets.LINODE_HOST }}
          username: ${{ secrets.LINODE_USERNAME }}
          key: ${{ secrets.LINODE_SSHKEY }}
          port: ${{ secrets.LINODE_PORT }}
          script: |
            ls -l

The key contains the private key of the key-pair I'm using to connect manually via command line.
As port I use 22, hope this is correct.

It does not work. I'm getting the following error.

ssh: handshake failed: ssh: unable to authenticate

What am I doing wrong?
Is there a better github action to use?

Thanks already!

2 Replies

Did you give GitHub the public key?

See here:

You can skip down to step 7.

-- sw

Hi @tobirie

I had the same problem.

Solved for me giving the allowed permissions for the keys in the remote server.

Change the permissions of .ssh to 700
Change the permissions of .ssh/authorized_keys to 640

here is my .yml

name: re-deploy application
on: [push]
    name: Build
    runs-on: ubuntu-latest
      - name: executing remote ssh commands using ssh key
        uses: appleboy/ssh-action@master
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USER_NAME }}
          key: ${{ secrets.SSH_PRIVATE_KEY }}
          port: ${{ secrets.PORT }}
          script: |


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct