Skip to content

All configured authentication methods failed #604

@shishir-sonekar

Description

@shishir-sonekar

I'm using this configuration:

function connectToSftp(sftpp, config) {
  let client = require('ssh2').Client;
  let Client = new client();

  	return new Promise((resolve, reject) => {
	    Client.on('ready', () => {
	      Client.sftp((err, sftp) => {
	        if (err) {
	          reject(err);
	        }
	        this.sftp = sftp;
	        resolve(sftp);
	      });
	    }).on('keyboard-interactive', function (name, instructions, instructionsLang, prompts, finish) {
	      console.log('Connection :: keyboard-interactive');
	      finish([config.password]);
	    }).on('error', (err) => {
	      reject(err);
	    }).connect(config);
	});
}

try{ 
	let client = require('ssh2').Client;
  	let sftp = new client();
	sftp.connect({ 
		host: '111.111.11.111', 
		port: 22, 
		username: '*********', 
		password: '*********',
	}) 
} catch(e){ 
	throw(e) 
}

giving error:

 ERROR ProcessId: 1503395610593 uncaughtException: All configured authentication methods failed 
 ERROR ProcessId: 1503395610593 Error: All configured authentication methods failed
     at tryNextAuth (/backend/node_modules/ssh2/lib/client.js:294:17)
     at SSH2Stream.onUSERAUTH_FAILURE (/backend/node_modules/ssh2/lib/client.js:473:5)
     at emitTwo (events.js:106:13)
     at SSH2Stream.emit (events.js:191:7)
     at parsePacket (/backend/node_modules/ssh2-streams/lib/ssh.js:3647:10)
     at SSH2Stream._transform (/backend/node_modules/ssh2-streams/lib/ssh.js:551:13)
     at SSH2Stream.Transform._read (_stream_transform.js:167:10)
     at SSH2Stream._read (/backend/node_modules/ssh2-streams/lib/ssh.js:212:15)
     at SSH2Stream.Transform._write (_stream_transform.js:155:12)
     at doWrite (_stream_writable.js:334:12)
     at writeOrBuffer (_stream_writable.js:320:5)
     at SSH2Stream.Writable.write (_stream_writable.js:247:11)
     at Socket.ondata (_stream_readable.js:555:20)
     at emitOne (events.js:96:13)
     at Socket.emit (events.js:188:7)
     at readableAddChunk (_stream_readable.js:176:18)
     at Socket.Readable.push (_stream_readable.js:134:10)
     at TCP.onread (net.js:548:20) 

I'm using the password based authentication rather than private key auth. Its not working in Linux server with this error. While, It is working when im trying in my MAC OS local machine
Please help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions