basic-ftp icon indicating copy to clipboard operation
basic-ftp copied to clipboard

530 “User cannot log in” on Microsoft FTP Server (works in FileZilla)

Open Mat40 opened this issue 10 months ago • 0 comments
trafficstars

Describe the bug
I’m encountering a 530 User cannot log in error when attempting to connect to a Microsoft FTP server using basic-ftp in Node.js. I’ve confirmed that the credentials and the IP address are correct, and I can successfully connect via FileZilla from the same IP with the same credentials. The server does not use TLS, so I’m connecting with secure: false.

Example code

const ftp = require("basic-ftp")

async function test() {
    const client = new ftp.Client()
    client.ftp.verbose = true
    
    try {
        await client.access({
            host: "192.168.65.89",
            user: "ftpuser",
            password: "PassWord=",
            port: 21,
            secure: false // No TLS
        })
        console.log("Connection successful!")
        console.log(await client.list())
        
    } catch(err) {
        console.error("FTP error:", err)
    } finally {
        client.close()
    }
}

test()

Console output

Connected to 192.168.65.89:21 (No encryption)
< 220 Microsoft FTP Service

> OPTS UTF8 ON
< 200 OPTS UTF8 command successful - UTF8 encoding now ON.

Login security: No encryption
> USER ftpuser
< 331 Password required

> PASS ###
< 530 User cannot log in.

Erreur FTP: FTPError: 530 User cannot log in.
    at FTPContext._onControlSocketData (...\basic-ftp\dist\FtpContext.js:283:39)
    at Socket.<anonymous> (...\basic-ftp\dist\FtpContext.js:127:44)
    at Socket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
  code: 530
}
> QUIT

Which version of Node.js are you using?
Node.js v21.5.0

Which version of basic-ftp are you using?
basic-ftp v5.0.5

Additional context

  • The same credentials from the same IP work correctly when using FileZilla.
  • The FTP server is a Microsoft FTP Service and does not use TLS (secure: false is set).
  • The connection fails with a 530 User cannot log in despite matching credentials.

Mat40 avatar Jan 08 '25 09:01 Mat40