ssh-action: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

This is my workflow file what i am trying to do with this action is on pushing to master

  • create a docker image
  • push the docker image to docker hub
  • ssh into my AWS EC2 server
  • run a set of instruction to update the docker image

on:
  push:
    branches: [master]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: docker login
      env:
        DOCKER_USER: ${{ secrets.DOCKER_USER }}
        DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
      run: |
        echo $DOCKER_PASSWORD | docker login -u $DOCKER_USER --password-stdin
    - name: Build the React Docker Image
      run: |
        docker build . --file Dockerfile --tag noobmaster147/feedachild-frontend
    - name: Docker push 
      run: |
        docker push noobmaster147/feedachild-frontend
    - name: Deploy
      uses: appleboy/ssh-action@master
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        key: ${{ secrets.KEY }}
        port: ${{ secrets.PORT }}
        script: |
          whoami
          pwd
          ls -la
          docker-compose down
          docker-compose pull
          docker-compose up --build -d

I am stuck with this issue for hours now.

image

the pem file that I am using was generated by aws, in the process of creating an instance

this is the command I use to ssh from my laptop ssh -i ~/Documents/feedachild.pem ubuntu@ec2-*-**-***-***.us-east-2.compute.amazonaws.com

therefore the secrets I added were HOST => ec2-*-**-***-***.us-east-2.compute.amazonaws.com PORT => 22 USERNAME => ubuntu KEY => pasted the RSA Key as it is

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 12
  • Comments: 19 (2 by maintainers)

Most upvoted comments

duplicated of #80

check permissions of authorized_key file and private key file

  • change permission authorized_key file chmod 640 .ssh/authorized_key

  • change permission .ssh file chmod 700 .ssh/private_key

You only need to authorize your key

cat ~/.ssh/id_rsa.pub >> authorized_key

It’s funny how something as trivial as this can keep one awake at night! Kuddos! cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

I am getting same error how Can I resolve this Issue “ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain”

You only need to authorize your key

cat ~/.ssh/id_rsa.pub >> authorized_key

check permissions of authorized_key file and private key file

  • change permission authorized_key file chmod 640 .ssh/authorized_key
  • change permission .ssh file chmod 700 .ssh/private_key

Is this in the EC2 instance or my local machine, kindly be more explicit