Question

I am trying to connect to an FTP server using:

ftp = Net::FTPFXPTLS.new
ftp.passive=true
ftp.debug_mode=true
ftp.connect('200.111.111.11',21)
ftp.login('Username','Pass')
ftp.chdir('inbound')
ftp.putbinaryfile("./#{filename}", "/#{filename}")
ftp.close()

For the purposes of this example 200.111.111.11 is the correct IP and 10.1.1.1 is the fake IP.

When I connect via an FTP client such as Transmit I connect fine and everything works as normal but in the transcript it states:

Cmd: PASV
227: Entering Passive Mode (10,1,1,1,47,79).
Fixing bogus PASV data address from 10.1.1.1:12111 to 200.111.111.11:12111.

Then when it tries to connect via the ruby script:

get: 425 Failed to establish connection.

When it tries to do any action like LIST or STOR because the PASV command always returns 10.1.1.1:12111.

So is there anyway to ensure the PASV command uses 200.111.111.11 and not what is sent back to it?

Était-ce utile?

La solution

This seems to be more of an issue with the gem, there is a solution for it but woud take a little while to implement. In order to save time we simply switched the protocol to use SFTP which works flawlessly. (Switched both server and code)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top