Open Rajaskr opened 10 years ago
Can you show the code you are using?
sure.Below is the code which i am use to create the connection object.,
var Client = require('ftp');
var c = new Client(); var Object = {}; Object.host = "ftps-af.cloud-vpn.net"; Object.port = '21'; Object.secure = 'true'; Object.tls = 'false'; Object.user = 'xxxxxxxx'; Object.pasvTimeout = 200000000; Object.keepalive = 20000000; Object.secureOptions = { rejectUnauthorized: false }; Object.password = 'yyyyyyyyy';
c.connect(Object);
Try something like this instead:
var Client = require('ftp');
var c = new Client();
var config = {
host: "ftps-af.cloud-vpn.net",
port: 21,
secure: true,
user: 'xxxxxxxx',
pasvTimeout: 20000,
keepalive: 20000
secureOptions: { rejectUnauthorized: false },
password: 'yyyyyyyyy'
};
c.connect(config);
One problem is that Object
is already a name used by JavaScript as the built-in base type for every object. Secondly, the types of some of your config settings were wrong (e.g. boolean and numeric values shouldn't be quoted). Also, you should verify what type of encryption your ftp server supports, whether it's implicit (more rare), control connection only, or both control and data connections.
Thanks for your detail.The ftp client host supports "Require explicit FTP over TLS" type of encryption. so, the secure config property has set as true.I have made changes based on your detail in my code. Even after also it is not connect. The call doesnot provide any results and waits at infinity.
Can you set the debug config option and paste the output to a gist or pastebin (censoring login info)?:
var Client = require('ftp');
var c = new Client();
var config = {
host: "ftps-af.cloud-vpn.net",
port: 21,
secure: true,
user: 'xxxxxxxx',
pasvTimeout: 20000,
keepalive: 20000
secureOptions: { rejectUnauthorized: false },
password: 'yyyyyyyyy',
debug: console.log
};
c.connect(config);
debug: console.log provides the following trace information.
[connection] < '220 (vsFTPd 2.2.2)\r\n' [parser] < '220 (vsFTPd 2.2.2)\r\n' [parser] Response: code=220, buffer='(vsFTPd 2.2.2)' [connection] > 'AUTH TLS' [connection] < '234 Proceed with negotiation.\r\n' [parser] < '234 Proceed with negotiation.\r\n' [parser] Response: code=234, buffer='Proceed with negotiation.' [connection] > 'USER xxxxx' [connection] < '331 Please specify the password.\r\n' [parser] < '331 Please specify the password.\r\n' [parser] Response: code=331, buffer='Please specify the password.' [connection] > 'PASS zzzzz' [connection] < '230 Login successful.\r\n' [parser] < '230 Login successful.\r\n' [parser] Response: code=230, buffer='Login successful.' [connection] > 'FEAT' [connection] < '211-Features:\r\n AUTH SSL\r\n AUTH TLS\r\n EPRT\r\n EPSV\r\n MDTM\r\n PASV\r\n' [connection] < ' PBSZ\r\n PROT\r\n REST STREAM\r\n SIZE\r\n TVFS\r\n UTF8\r\n211 End\r\n' [parser] < '211-Features:\r\n AUTH SSL\r\n AUTH TLS\r\n EPRT\r\n EPSV\r\n MDTM\r\n PASV\r\n PBSZ\r\n PROT\r\n REST STREAM\r\n SIZE\r\n TVFS\r\n UTF8\r\n211 End\r\n' [parser] Response: code=211, buffer='Features:\r\n AUTH SSL\r\n AUTH TLS\r\n EPRT\r\n EPSV\r\n MDTM\r\n PASV\r\n PBSZ\r\n PROT\r\n REST STREAM\r\n SIZE\r\n TVFS\r\n UTF8\r [connection] > 'TYPE I' [connection] < '200 Switching to Binary mode.\r\n' [parser] < '200 Switching to Binary mode.\r\n' [parser] Response: code=200, buffer='Switching to Binary mode.' [connection] > 'PASV' [connection] < '227 Entering Passive Mode (197,96,16,131,6,70).\r\n' [parser] < '227 Entering Passive Mode (197,96,16,131,6,70).\r\n' [parser] Response: code=227, buffer='Entering Passive Mode (197,96,16,131,6,70).' [connection] PASV socket connected [connection] > 'LIST' [connection] < '522 Data connections must be encrypted.\r\n' [parser] < '522 Data connections must be encrypted.\r\n' [parser] Response: code=522, buffer='Data connections must be encrypted.'
D:\ftplist.js:43 throw err; ^ Error: Data connections must be encrypted.
Please look on this below trace information. In this trace the final response code is 150 and buffer message like "buffer='Here comes the directory listing.'''...but it takes much more time to complete the transfer. still it hangs on this stage and does not list the directories. Here is a trace detail.
D:>node ftplist.js [connection] < '220 (vsFTPd 2.2.2)\r\n' [parser] < '220 (vsFTPd 2.2.2)\r\n' [parser] Response: code=220, buffer='(vsFTPd 2.2.2)' [connection] > 'AUTH TLS' [connection] < '234 Proceed with negotiation.\r\n' [parser] < '234 Proceed with negotiation.\r\n' [parser] Response: code=234, buffer='Proceed with negotiation.' [connection] > 'PBSZ 0' [connection] < '200 PBSZ set to 0.\r\n' [parser] < '200 PBSZ set to 0.\r\n' [parser] Response: code=200, buffer='PBSZ set to 0.' [connection] > 'PROT P' [connection] < '200 PROT now Private.\r\n' [parser] < '200 PROT now Private.\r\n' [parser] Response: code=200, buffer='PROT now Private.' [connection] > 'USER zzzzzzz' [connection] < '331 Please specify the password.\r\n' [parser] < '331 Please specify the password.\r\n' [parser] Response: code=331, buffer='Please specify the password.' [connection] > 'PASS yyyyyyyy' [connection] < '230 Login successful.\r\n' [parser] < '230 Login successful.\r\n' [parser] Response: code=230, buffer='Login successful.' [connection] > 'FEAT' [connection] < '211-Features:\r\n AUTH SSL\r\n' [connection] < ' AUTH TLS\r\n EPRT\r\n' [connection] < ' EPSV\r\n MDTM\r\n PASV\r\n PBSZ\r\n PROT\r\n' [connection] < ' REST STREAM\r\n SIZE\r\n' [connection] < ' TVFS\r\n UTF8\r\n211 End\r\n' [parser] < '211-Features:\r\n AUTH SSL\r\n AUTH TLS\r\n EPRT\r\n EPSV\r\n MDTM\r\n PASV\r\n PBSZ\r\n PROT\r\n REST STREAM\r\n SIZE\r\n TVFS\r\n UTF8\r\n211 End\r\n' [parser] Response: code=211, buffer='Features:\r\n AUTH SSL\r\n AUTH TLS\r\n EPRT\r\n EPSV\r\n MDTM\r\n PASV\r\n PBSZ\r\n PROT\r\n REST STREAM\r\n SIZE\r\n TVFS\r\n UTF8\r\nEnd' [connection] > 'TYPE I' [connection] < '200 Switching to Binary mode.\r\n' [parser] < '200 Switching to Binary mode.\r\n' [parser] Response: code=200, buffer='Switching to Binary mode.' [connection] > 'PASV' [connection] < '227 Entering Passive Mode (197,96,16,131,6,193).\r\n' [parser] < '227 Entering Passive Mode (197,96,16,131,6,193).\r\n' [parser] Response: code=227, buffer='Entering Passive Mode (197,96,16,131,6,193).' [connection] PASV socket connected [connection] > 'LIST' [connection] < '150 Here comes the directory listing.\r\n' [parser] < '150 Here comes the directory listing.\r\n' [parser] Response: code=150, buffer='Here comes the directory listing.'
Wait, did you change your code or anything? That's two different sets of debug output.
For first trace i have passed the config attribute like secure: 'true'. But this is also works fine except this one. But in second trace i have passed like secure : true. This is the only difference between the traces.
Hi, I have faced some issue in ftp-client module.In node.js i created the connection object with the secure property is set to true. But, when i debug the code for list the directories in ftp the connection object throws the "Error: Data connections must be encrypted". Please assist me to resolve this issue.