Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
noob-master147 opened this issue Nov 21, 2020 · 19 comments

Comments

@noob-master147
Copy link

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

@appleboy
Copy link
Owner

duplicated of #80

@Yaqoob-Aslam
Copy link

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"

@appleboy
Copy link
Owner

appleboy commented Apr 4, 2023

@Yaqoob-Aslam Do you refer to https://github.com/appleboy/ssh-action#setting-up-a-ssh-key guide?

@Dev-El-badry
Copy link

Dev-El-badry commented Apr 5, 2023

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

@shylock-wu
Copy link

Is this the file in the aws server?

@nhastor1
Copy link

In case of administrative user on windows, you need to add your public key into file named administrators_authorized_keys in C:\ProgramData\ssh\.

@ct123-cmd
Copy link

ct123-cmd commented Oct 9, 2023

You only need to authorize your key

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

@syntaxlexx
Copy link

syntaxlexx commented Oct 11, 2023

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

@sugurugojow
Copy link

@syntaxlexx where do i have to put this in my local or my ec2 instance ?

@ct123-cmd
Copy link

ct123-cmd commented Oct 11, 2023

This is just a way to authorize your key when connecting using SSH, it depends on your requirements.
what is your purpose? building a CI/CD pipeline or a code pipeline from local to GitHub or somewhere?

@sugurugojow
Copy link

for ci/cd pipeline

@ct123-cmd
Copy link

ct123-cmd commented Oct 11, 2023

This is something needs to check from start to end, but what I can see in your error logs, you did something wrong with your key files, and that's why you are not able to push the code, You can start with a new key files there, make sure you give right permissions and proper approach for that

@dapobelieve
Copy link

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

@Mfonn
Copy link

Mfonn commented Dec 5, 2023

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

This worked for me!!!

@DesKevinMendez
Copy link

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

Working... thanks.

This command must be past into EC2 o Droplet (digitalOcean)

@EdvardasP
Copy link

For me the problem was with permissions on authorized_keys file. It had 664, changing to 600 helped and deployment works again.

@gerlynm
Copy link

gerlynm commented Jan 10, 2024

ssh is different to sshd. Make sure you have set PasswordAuthentication to yes in the SSHD file, and restarted the sshd service.

@ucodefusion
Copy link

Step 1
image
Add this values to github ,

If you not sure what it is
SERVER_IP your server ip ping your_server_domain.com
SERVER_USER AWS EC2, DigitalOcean, or Azure, the default username will be ubuntu. If you're using a different or a custom setup, the default user might be root, ec2-user (for Amazon Linux),
SSH_PRIVATE_KEY your server private key cat ~/.ssh/id_rsa

Step 2

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

Step 3 Run your pipeline

@seniorpung
Copy link

when I access cPanel using ssh client, I got this error.
How to handle this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests