Error: All configured authentication methods failed , when connecting to vsftpd server created on aws , using npm module - ssh2-sftp-client

Viewed 1309

code used to connect the vsftpd server

sftp.connect({

host: "3.6.75.65"

port: "22"

username: "ashish-ftp"

password: "*******"

})
.then(() => {

console.log("result")

})
.catch((err)=>{

console.log("error")

})

I had done setup VSFTPD server for file transfer in aws and try to connect using the npm module - ssh2-sftp-client , it show a error given below

Error: All configured authentication methods failed

at tryNextAuth (/home/ashish/addis/node_modules/ssh2/lib/client.js:392:17)

at SSH2Stream.onUSERAUTH_FAILURE (/home/ashish/addis/node_modules/ssh2/lib/client.js:599:5)

at emitTwo (events.js:126:13)

at SSH2Stream.emit (events.js:214:7)

at parsePacket (/home/ashish/addis-pianca/node_modules/ssh2-streams/lib/ssh.js:3930:10)

at SSH2Stream._transform (/home/ashish/addis-pianca/node_modules/ssh2-streams/lib/ssh.js:671:13)

at SSH2Stream.Transform._read (_stream_transform.js:186:10)

at SSH2Stream._read (/home/ashish/addis-pianca/node_modules/ssh2-streams/lib/ssh.js:253:15)

at SSH2Stream.Transform._write (_stream_transform.js:174:12)

at doWrite (_stream_writable.js:397:12)

at writeOrBuffer (_stream_writable.js:383:5)

at SSH2Stream.Writable.write (_stream_writable.js:290:11)

at Socket.ondata (_stream_readable.js:639:20)

at emitOne (events.js:116:13)

at Socket.emit (events.js:211:7)

at addChunk (_stream_readable.js:263:12)

at readableAddChunk (_stream_readable.js:250:11)

at Socket.Readable.push (_stream_readable.js:208:10)

at TCP.onread (net.js:607:20) level: 'client-authentication'

When connect with filezilla it shows an error

Error: FATAL ERROR: No supported authentication methods available (server sent: publickey)
Error: Could not connect to server

Please help how to connect the FTP sever using NPM module.

1 Answers

This is an old question but got the same issue recently with the ssh2 JS package.

  1. Make sure have access to the remote string, ssh to the site and see if that works with your keys/config/server setup etc.

  2. If plain ssh from the console above works: Make sure your code is using the correct key version/format. An easy test is just to call and print out the result to utils.parseKey("your key here"). Utils is a library in ssh2.

  3. Ensure your app is using the correct key.

Related