ssh-action
ssh-action copied to clipboard
ssh: unable to authenticate, attempted methods [none], no supported methods remain
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
I have the same setup actually... Same problem
I have the same problem.
@vishwasg217 What is your os version on DROPLET?
Please post your config /etc/ssh/sshd_config
and all config files in /etc/ssh/sshd_config.d/
.
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
Please use the following command
ssh-copy-id -i ~/.ssh/id_rsa.pub account@hostname
Also been having the issue:
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 Can you also post your ssh-action config? your key begin with -----BEGIN RSA PRIVATE KEY-----
right?
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 Please try the solution from https://github.com/appleboy/ssh-action/issues/232#issuecomment-1506493783 for git pull
scenario.
@appleboy unfortunately it doesn't work either..
I change the to @master and it's work.
uses: appleboy/ssh-action@master
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.
Run this command after editing authorized_keys file
sed -i '1 s/^\xef\xbb\xbf//' /root/.ssh/authorized_keys
It worked for me.
For me the problem was with permissions on authorized_keys file. It had 664, changing to 600 helped and deployment works again.