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: unable to authenticate, attempted methods [none], no supported methods remain #251

Open
vishwasg217 opened this issue May 17, 2023 · 15 comments

Comments

@vishwasg217
Copy link

This is my github actions workflow file:

name: Deploy ML Model Web App

on:
push:
branches: [ main ]

jobs:
build-and-deploy:
runs-on: ubuntu-20.04

steps:
  - name: Checkout Repo
    uses: actions/checkout@v2
  
  - name: SSH into server
    uses: appleboy/ssh-action@master
    with:
      host: ${{ secrets.HOST }}
      username: root
      password: ${{ secrets.DO_DROPLET_SSH_PASS }}
      script: |
        cd Predictive-Maintenance
        git pull origin main
        docker rm -f $(docker ps -aq)
        docker rmi -f $(docker images -aq)
        docker-compose build
        docker-compose up -d

Error: ssh: unable to authenticate, attempted methods [none], no supported methods remain
please help me out with this

@ahmetkaratass
Copy link

I have the same setup actually... Same problem

@Francesco-Sch
Copy link

I have the same problem.

@appleboy
Copy link
Owner

appleboy commented Jun 4, 2023

@vishwasg217 What is your os version on DROPLET?

image

@appleboy
Copy link
Owner

appleboy commented Jun 4, 2023

Please post your config /etc/ssh/sshd_config and all config files in /etc/ssh/sshd_config.d/.

@meditto
Copy link

meditto commented Jun 4, 2023

Make sure you added the public key to the authorized_keys file. You can do it like so
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

@appleboy
Copy link
Owner

appleboy commented Jun 4, 2023

Please use the following command

ssh-copy-id -i ~/.ssh/id_rsa.pub account@hostname

@Maxservais
Copy link

Also been having the issue:
image

This is what my /etc/ssh/sshd_config file looks like:

Include /etc/ssh/sshd_config.d/*.conf
PermitRootLogin yes
PubkeyAuthentication yes
PasswordAuthentication no
KbdInteractiveAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem       sftp    /usr/lib/openssh/sftp-server

In /etc/ssh/sshd_config.d/, I only have a config file called 50-cloud-init.conf filled with PasswordAuthentication no

FYI: I set up the github secrets correctly (host, username, key and passphrase) and added my public key to github. I can connect fine from my droplet using the command ssh -T git@github.com and I can pull manually.

Any idea what is wrong? Been struggling with that issue for a few hours..

@appleboy
Copy link
Owner

appleboy commented Jun 6, 2023

@Maxservais Can you also post your ssh-action config? your key begin with -----BEGIN RSA PRIVATE KEY----- right?

@Maxservais
Copy link

Hello, yes I copy the full private key.

This is (a slightly shorter version of) my github action workflow:


# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the staging branch
  push:
    branches: [staging]
  pull_request:
    branches: [staging]

  # Allows to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    environment: staging
    steps:
      - name: executing remote ssh commands using password
        uses: appleboy/ssh-action@v0.1.10
        with:
          host: ${{ secrets.DIGITALOCEAN_DROPLET_IP }}
          username: ${{ secrets.DIGITALOCEAN_DROPLET_USERNAME }}
          key: ${{ secrets.DIGITALOCEAN_DROPLET_SSH_KEY }}
          passphrase: ${{ secrets.DIGITALOCEAN_DROPLET_PASSPHRASE }}
          script: |
            whoami
            ls -al
            cd /project-folder/
            git pull 

@appleboy
Copy link
Owner

appleboy commented Jun 7, 2023

@Maxservais Please try the solution from #232 (comment) for git pull scenario.

@Maxservais
Copy link

@appleboy unfortunately it doesn't work either..

@ericlou168
Copy link

I change the to @master and it's work.
uses: appleboy/ssh-action@master

@arman-mukatov
Copy link

Has anyone figured out the cause of this error? I have two projects, where one is working correctly, but the other one is throwing this error. The configurations are identical.

@malbruk
Copy link

malbruk commented Oct 16, 2023

Run this command after editing authorized_keys file
sed -i '1 s/^\xef\xbb\xbf//' /root/.ssh/authorized_keys

It worked for me.

@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.

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

10 participants