question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting "All configured authentication methods failed" using private key (password-base is working) on a seemingly well-configured server

See original GitHub issue

First of all - password base authentication is working properly.

I’m trying to run commands on a VPS using private key, I’ve configured SSH there like this:

cd ~/.ssh
ssh-keygen -t rsa -b 4096 -C "test@example.com" # passphrase is empty
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

Then I copied the private key to my repo secrets from this file:

cat ~/.ssh/id_rsa

The key looks like this:

-----BEGIN RSA PRIVATE KEY-----
data...
-----END RSA PRIVATE KEY-----

Here is my workflow config:

name: Deploy

on: 
  push:
    branches: master

jobs:
  deploy:
    runs-on: ubuntu-latest
    
    steps:
    - name: Updating and restarting the service on remote host
      uses: garygrossgarten/github-action-ssh@release
      with:
        host: ${{ secrets.RR_HOST }} # ip address i use to access the server with 'ssh user@ip'
        username: ${{ secrets.RR_USERNAME }} # username "test@example.com"
        privateKey: ${{ secrets.RR_PRIVATE }} # private key of my VPS ~/.ssh/id_rsa file
        command: |
          cd dc-apps/go/linksmap/
          docker-compose down
          git reset --hard
          git pull
          go get ./...
          docker-compose up -d

When I try to run the job I get this:

Run garygrossgarten/github-action-ssh@release
  with:
    host: ***
    username: ***
    privateKey: ***
    command: cd dc-apps/go/linksmap/
  docker-compose down
  git reset --hard
  git pull
  go get ./...
  docker-compose up -d
  
    port: 22
(node:2404) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Establishing a SSH connection to ***.
using provided private key
⚠️ The GitHub Action couldn't connect to ***. Error: All configured authentication methods failed
    at doNextAuth (/home/runner/work/_actions/garygrossgarten/github-action-ssh/release/dist/index.js:11803:17)
    at tryNextAuth (/home/runner/work/_actions/garygrossgarten/github-action-ssh/release/dist/index.js:11874:5)
    at SSH2Stream.onUSERAUTH_FAILURE (/home/runner/work/_actions/garygrossgarten/github-action-ssh/release/dist/index.js:11987:5)
    at SSH2Stream.emit (events.js:210:5)
    at parsePacket (/home/runner/work/_actions/garygrossgarten/github-action-ssh/release/dist/index.js:16883:10)
    at SSH2Stream.module.exports.635.SSH2Stream._transform (/home/runner/work/_actions/garygrossgarten/github-action-ssh/release/dist/index.js:13902:13)
    at SSH2Stream.Transform._read (_stream_transform.js:189:10)
    at SSH2Stream.module.exports.635.SSH2Stream._read (/home/runner/work/_actions/garygrossgarten/github-action-ssh/release/dist/index.js:13454:15)
    at SSH2Stream.Transform._write (_stream_transform.js:177:12)
    at doWrite (_stream_writable.js:431:12) {
  level: 'client-authentication'
}
⚠️ An error happened executing command cd dc-apps/go/linksmap/
docker-compose down
git reset --hard
git pull
go get ./...
docker-compose up -d. Not connected
Error: All configured authentication methods failed
Executing command: cd dc-apps/go/linksmap/
docker-compose down
git reset --hard
git pull
go get ./...
docker-compose up -d
Error: Not connected
 1: 0x9da7c0 node::Abort() [/home/runner/runners/2.275.1/externals/node12/bin/node]
 2: 0xa4e219  [/home/runner/runners/2.275.1/externals/node12/bin/node]
 3: 0xba5d59  [/home/runner/runners/2.275.1/externals/node12/bin/node]
 4: 0xba7b47 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/home/runner/runners/2.275.1/externals/node12/bin/node]
 5: 0x13750d9  [/home/runner/runners/2.275.1/externals/node12/bin/node]

What am I doing wrong here?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
andreatoppancommented, Aug 31, 2022

Seems newer Ubuntu 22.04 has changed default accepted key types and this plugin sometimes is not working, the solution for me was to generate the private key with a different algorithm:

cd ~/.ssh ssh-keygen -t ecdsa -b 521 -C "test@example.com" # passphrase is empty ssh-copy-id -i ~/.ssh/id_ecdsa.pub "test@example.com"

0reactions
godstaniscommented, Jan 23, 2021

@AxelPariss I guess this process is pretty generic and you can google it like in 5 seconds, but why not 👌

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rundeck ssh: Failed: AuthenticationFailure: Authentication ...
On Rundeck side, make sure that you're using a well-configured node definition. I used the following resources.xml content example:.
Read more >
Hacking exposed mobile by hatty-ebooks - Issuu
Read Hacking exposed mobile by hatty-ebooks on Issuu and browse thousands of other publications on our platform. Start here!
Read more >
A Conversation About '2 Factor Authentication'
In the FileMaker standard model we are using two things the user knows (login and password), and only one of them is assumed...
Read more >
Information Security.pdf - Yumpu
9.3.2 Authentication Using Public Keys .................. 217 ... My work in information security began when I was in graduate school.
Read more >
Rhodes Goerzen THIRD EDITION - Springer
running so that Python scripts from this book can be run on the other machines in ... (at least on my Linux laptop...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found