atinux / node-ftps

FTP, FTPS and SFTP client for node.js, mainly a lftp wrapper.
MIT License
202 stars 57 forks source link

not able to connect with sftp server #79

Open vikaskumr opened 4 years ago

vikaskumr commented 4 years ago

FTP { options: { host: 'host', username: 'username', password: 'password', port: 990, escape: true, retries: 1, timeout: 10, retryInterval: 5, retryIntervalMultiplier: 1, requiresPassword: true, protocol: 'sftp', autoConfirm: true, cwd: '', additionalLftpCommands: 'set ssl-allow true;set ssl:verify-certificate no;set passive-mode yes', requireSSHKey: false, sshKeyPath: '' }, cmds: [] }

I am trying to connect my sftp server with this configuration but I am always getting

{ error: 'ls: Fatal error: max-retries exceeded\n', data: '' }

MichielMag commented 3 years ago

Hey @vikaskumr, it's been a while, but do you still need help? On my first gaze I can see that you tried to use port 990 (FTPS) for an SFTP server (which are hosted on port 22 most of the time).

mynameiszsofia commented 3 years ago

I would like to reopen this issue with my problem if this is possible. My problem is the same as it mentioned above, i attach the code what i use:

import ftps from 'ftps';

export default (feedbackConfig: ftps.FTPOptions): ftps => {
  const {host, username, password, protocol, port} = feedbackConfig;

  return new ftps({
    host,
    username,
    password,
    protocol,
    port,
    autoConfirm: true,
    additionalLftpCommands: ['set ssl-allow true', 'set ssl:verify-certificate no', 'set passive-mode yes'].join(';'),
  });
};

The error message is : Fatal error: max-retries exceeded The sftp content is correct i can join to the sftp with FileZilla if this mean something, and the port is 22 so i would like to connect to sftp.

Any help would appreciate.

MichielMag commented 3 years ago

Hey @mynameiszsofia I understand why you're stuck there, because everything looks fine on the surface.

Could you try to debug your problem using the LFTP command directly in your CLI? It should probably give you a more detailed error.

I also had some issues with certificates in the past by the way. One way to solve that was to manually download the certificate from the server and adding it to the certificate storage of my OS.

mynameiszsofia commented 3 years ago

Thank you so much for the fast reply, i will try to debug, and i will report what i found even if i could fix or not, for the future interest

mynameiszsofia commented 3 years ago

@MichielMag i returned with the debug message, i need some help because it's not really tell me something: [702] hostname ---> sending a packet, length=5, type=1(INIT), id=0 [702] hostname **** Timeout - reconnecting [702] hostname ---- Disconnecting it's reconnecting i see but i don't know why, we investigate the sftp connection and it's fine

any help would appreciate, thank you!

MichielMag commented 3 years ago

Is LFTP running om the same device as your FileZilla?

mynameiszsofia commented 3 years ago

actually no because the lftp is running in docker container but we checked the sftp connection via FileZilla in a local computer

MichielMag commented 3 years ago

Can you ping the server from that docker container? Can you use the SSH command from that container to connect to your SSH server?

It sounds to me like it actually is a network issue.

mynameiszsofia commented 3 years ago

@MichielMag thank you so much for your time and sorry for the interrupt, our problem was with proxy so yes it was a network issue.