ssh-action icon indicating copy to clipboard operation
ssh-action copied to clipboard

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

Open vishwasg217 opened this issue 1 year ago • 15 comments

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

vishwasg217 avatar May 17 '23 18:05 vishwasg217

I have the same setup actually... Same problem

ahmetkaratass avatar May 19 '23 12:05 ahmetkaratass

I have the same problem.

Francesco-Sch avatar May 31 '23 17:05 Francesco-Sch

@vishwasg217 What is your os version on DROPLET?

image

appleboy avatar Jun 04 '23 06:06 appleboy

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

appleboy avatar Jun 04 '23 08:06 appleboy

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

meditto avatar Jun 04 '23 12:06 meditto

Please use the following command

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

appleboy avatar Jun 04 '23 12:06 appleboy

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 [email protected] and I can pull manually.

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

Maxservais avatar Jun 06 '23 18:06 Maxservais

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

appleboy avatar Jun 06 '23 22:06 appleboy

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/[email protected]
        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 

Maxservais avatar Jun 07 '23 07:06 Maxservais

@Maxservais Please try the solution from https://github.com/appleboy/ssh-action/issues/232#issuecomment-1506493783 for git pull scenario.

appleboy avatar Jun 07 '23 14:06 appleboy

@appleboy unfortunately it doesn't work either..

Maxservais avatar Jun 12 '23 10:06 Maxservais

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

ericlou168 avatar Jun 13 '23 18:06 ericlou168

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.

arman-mukatov avatar Jun 14 '23 04:06 arman-mukatov

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

It worked for me.

malbruk avatar Oct 16 '23 21:10 malbruk

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

EdvardasP avatar Jan 10 '24 07:01 EdvardasP