简体   繁体   English

如何连接到只有用户名但没有密码的GoDaddy的FTP服务器?

[英]How do I connect to GoDaddy's FTP server which has only a username and no password?

I am trying to download a zip file from GoDaddy's ftp server with node-ftp, but node-ftp changes empty passwords to 'anonymous@' by default in their connect function. 我正在尝试使用node-ftp从GoDaddy的ftp服务器下载一个zip文件,但是默认情况下,node-ftp在其connect函数中将空密码更改为“ anonymous @”。 How can I connect to their FTP server using only a username and no password? 如何仅使用用户名而不使用密码连接到他们的FTP服务器?

Scanned the source code, they change the password to anonymous@ here: https://github.com/mscdex/node-ftp/blob/master/lib/connection.js#L92 扫描源代码,他们将密码更改为anonymous @, 网址为https : //github.com/mscdex/node-ftp/blob/master/lib/connection.js#L92

const FTPClient = require('ftp');
const fs = require('fs');
const extract = require('extract-zip');

let getGoDaddyAuctionListings = () => {

    let config = {
        directory: "/tmp/",
        file: "auctions_ending_today.json.zip"
    };
    config.filePath = config.directory + config.file;
    let c = new FTPClient();

    c.on('ready', () => {
        c.get(config.file, (err, stream) => {
            if (err) throw err; //todo: change to handleError function
            stream.once('close', () => { c.end(); });
            stream.pipe(fs.createWriteStream(config.filePath));
            extract(config.filePath, {dir:config.dir}, (err) => {
               if (err) throw err;
            });
        })
    });

    c.connect({
        host: 'ftp.godaddy.com',
        user: 'auctions',
        password: ' '
    });

};

getGoDaddyAuctionListings();
> node godaddyAuctions.js

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: Login incorrect.
    at makeError (C:\Users\jim\pbn-finder\node_modules\ftp\lib\connection.js:1067:13)
    at Parser.<anonymous> (C:\Users\jim\pbn-finder\node_modules\ftp\lib\connection.js:113:25)
    at Parser.emit (events.js:189:13)
    at Parser._write (C:\Users\jim\pbn-finder\node_modules\ftp\lib\parser.js:59:10)
    at doWrite (_stream_writable.js:415:12)
    at writeOrBuffer (_stream_writable.js:399:5)
    at Parser.Writable.write (_stream_writable.js:299:11)
    at Socket.ondata (C:\Users\jim\pbn-finder\node_modules\ftp\lib\connection.js:273:20)
    at Socket.emit (events.js:189:13)
    at addChunk (_stream_readable.js:288:12)
Emitted 'error' event at:
    at Object.reentry [as cb] (C:\Users\jim\pbn-finder\node_modules\ftp\lib\connection.js:192:14)
    at Parser.<anonymous> (C:\Users\jim\pbn-finder\node_modules\ftp\lib\connection.js:113:22)
    at Parser.emit (events.js:189:13)
    [... lines matching original stack trace ...]
    at addChunk (_stream_readable.js:288:12)

This code: 这段代码:

this.options.password = options.password ||
    options.password === '' ? options.password : 'anonymous@';

allows an empty password, but you are not giving it an empty one: 允许输入一个空密码,但您没有它一个空密码:

password: ' '

You've set the password to a space. 您已将密码设置为空格。 Do this: 做这个:

password: ''

and it should work fine. 它应该可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何仅使用用户名而不使用密码登录 aws cognito - How do I login to aws cognito only with username, without password 我应该如何将用户名和密码发送到服务器? - How should I send the username and a password to the server? 如何使用Ajax将用户名和密码发送到快递服务器? - How can I send username and password to an express server with ajax? 如何在nodejs中设置ftp-srv的用户名和密码? - how to set username and password of ftp-srv in nodejs? 如何使用用户名和密码连接 mongodb(mongoose)? - How to connect mongodb(mongoose) with username and password? Nodejs + Mongo数据库使用用户名和密码连接服务器数据库 - Nodejs + Mongo db connect with server database with username and password 为什么我需要用户名和密码才能将电子邮件发送到gmail smtp服务器 - Why do I need a username & password to send an email to gmail smtp server 如何将本地nodeJS服务器与在AWS上运行的MySQL连接? - How do I connect local nodeJS server with MySQL which is running on AWS? Node.js, 如何从一些 url 中获取 JSON 元素,我必须在其中输入用户名和密码? - Node.js, How to get JSON elemet from some url which i have to enter username and password in it? 如何使用用户名和密码连接到 redis db - how to connect to redis db with username and password nodejs node-redis
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM