Error: All configured authentication methods failed

Open
#438 10 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, node.js

Research direction

The report provides a Node.js connection script and a stack trace through node_modules/ssh2/lib/client.js; start by reproducing the connection with the shown options and comparing it with the working ssh command. Done would require identifying a reproducible node-ssh authentication or configuration cause and documenting a concrete fix or guidance.

Written by the indexing model from the issue text.

Description

Hello!

I'm trying to test out connecting to an EC2 instance with a simple script:

const { NodeSSH } = require('node-ssh')

const ssh = new NodeSSH()

ssh.connect({
  host: 'ec<some-ip>.compute-1.amazonaws.com',
  username: 'ubuntu'
}).then(function() {
  return ssh.execCommand('cd /home/ubuntu/ && ls')
}).catch(function(err) {
  console.log('error: ', err)
})

When doing so, I get the following:

Error: All configured authentication methods failed
    at doNextAuth (/Users/me/Desktop/code/node-ssh-test/node_modules/ssh2/lib/client.js:803:21)
    at tryNextAuth (/Users/me/Desktop/code/node-ssh-test/node_modules/ssh2/lib/client.js:993:7)
    at USERAUTH_FAILURE (/Users/me/Desktop/code/node-ssh-test/node_modules/ssh2/lib/client.js:373:11)
    at 51 (/Users/me/Desktop/code/node-ssh-test/node_modules/ssh2/lib/protocol/handlers.misc.js:337:16)
    at Protocol.onPayload (/Users/me/Desktop/code/node-ssh-test/node_modules/ssh2/lib/protocol/Protocol.js:2025:10)
    at ChaChaPolyDecipherBinding.decrypt (/Users/me/Desktop/code/node-ssh-test/node_modules/ssh2/lib/protocol/crypto.js:851:26)
    at Protocol.parsePacket [as _parse] (/Users/me/Desktop/code/node-ssh-test/node_modules/ssh2/lib/protocol/Protocol.js:1994:25)
    at Protocol.parse (/Users/me/Desktop/code/node-ssh-test/node_modules/ssh2/lib/protocol/Protocol.js:293:16)
    at Socket.<anonymous> (/Users/me/Desktop/code/node-ssh-test/node_modules/ssh2/lib/client.js:713:21)
    at Socket.emit (events.js:400:28) {
  level: 'client-authentication'
}

However, I am able to ssh into this server directly:

ssh ubuntu@ec<some-ip>.compute-1.amazonaws.com

Is there anything you can recommend for what might be causing the authentication methods to fail from node-ssh?

Many thanks!

Dominant language
TypeScript
Stars
1k
Forks
94
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from steelbrain/node-ssh

All issues in steelbrain/node-ssh

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.