How to upload a file from PC to AS400 machine using FTP Command - ftp

Need a Help about FTP command PUT.
Requirement is to upload a file from Windows PC to AS400 machine. Here is the command (running as a batch file) I am using:
open ipAddress
Kishore //user
pwd //password
quote RCMD CRTLIB LIB(TESTXA) TEXT('TESTXA Java Application Source') //Successfully creates TESTXA library
quote RCMD CRTSRCPF FILE(TESTXA/QJAVASRC) RCDLEN(200) TEXT('Java Source File') //Successfully creates source file QJAVASRC under TESTXA library
put "D:\Shared\JavaTest\ClobTest.java" /QSYS.LIB/TESTXA.LIB/QJAVASRC.FILE/CLOBTEST.MBR // Generating error 'ftp: bind : can't assign requested '
quote RCMD CHGPFM FILE(TESTXA/QJAVASRC) MBR(CLOBTEST) SRCTYPE(JAVA) TEXT('ClobTest') // Not executing due to previous command error
bye
Please suggest what am doing wrong with PUT command??
Thanks in advance

Smells like a firewall. Before doing the PUT, try setting passive mode. quote pasv

Specify namefmt 0 before put. Namefmt 0 tells ftp to use library/object naming.

Check the client proxy settings.
Bind: Can't Assign Requested Address from Ftp.exe Using Winsock Proxy
If the IP address of an external interface on the Proxy Server is in the LAT, it is considered by the proxy client to be internal. Because the client computer does not have an interface with the same IP address as the external IP address of the Proxy Server, you get the above error message.

Related

Transfer Files through FTP in Windows Batch Scripts having Private Key

I am using these command to transfer a file to an SFTP location.It has an private key(Puttygen) with
passphrase.
open ftp://%1%:%2%#%3%/ -explicittls -certificate="32:4b:5e:a7:05:b9:e4:2d:7d:44:cb:c1:0e:ee:0e:17"-privatekey=D:\SSIS_DEV\DBTeam\Transfer\Rural\Private.ppk
put %4%
I am getting a timeout error while connecting.
exit
You want to use SFTP, but use FTP (ftp://) protocol in the session URL.
Use sftp:// instead:
open sftp://%1%:%2%#%3%/
FTP and SFTP are two completely different and incompatible protocols. You get the timeout, because you are trying to connect to the FTP port, which the server does not listen on.

Unable to Retrieve Directory Using ProFTPD(WHM)

Well, after looking for many solutions. I came here now.
I am setting up WHM/cPanel for hosting website. Everything was going smooth but I am stuck on FTP connection (Server sent passive reply with unroutable address. Using server address instead.)
Server Details:
CentOS Linux release 7.2.1511 (Core)
WHM/cPanel Version 11.58.0.13
FTP Server: PureFTPD
Acutal error while connecting
To fix this issue and get FTP working you need to open up more numbered ports so FTP can connect. I assume you are using CSF.
Login to WHM then go to CSF >> Firewall Configuration >>
allow TCP_In 30000:50000 and TCP_Out 30000:50000
Once you made the changes Restart the firewall
Now you need to make changes in FTP config file to use these ports, you will find this file to this location /etc/pure-ftpd.conf
Now you will see a line as follows and you will need to uncomment it
# Port range for passive connections replies. - for firewalling.
PassivePortRange 30000 50000
Restart FTP Service and should work.

Accessing FTP server behind a proxy via command prompt in Windows 7

I want to connect to the FTP server ftp://trmmopen.gsfc.nasa.gov/pub/merged/3B42RT from my command prompt in Windows 7.
It's always showing not connected.
I am running my PC behind proxy. I came to know about port error. Followed this solution here about port forwarding but still no result.
Windows built-in command-line ftp.exe client does not support connecting over a proxy. It also supports an active mode only, what makes it difficult to connect though proxy anyway (even if some transparent proxy solution is used).
You have to use a 3rd party command-line FTP client that supports a passive mode and a proxy.
For example with WinSCP FTP client, you can use the following batch file (.bat):
WinSCP.com /command ^
"open ftp://anonymous:dummy#trmmopen.gsfc.nasa.gov/ -rawsettings ProxyMethod=3 ProxyHost=proxy ProxyUsername=username ProxyPassword=password" ^
"cd /pub/merged/3B42RT" ^
"ls" ^
"exit"
See a guide to scripting with WinSCP and a guide for converting Windows FTP script to WinSCP script.
The above code is for an HTTP proxy. If you use a different proxy type, alter the ProxyMethod setting accordingly. See https://winscp.net/eng/docs/rawsettings
Though easier is to configure the connection in WinSCP GUI and then have it generate a script template for you.
(I'm the author of WinSCP)

Downloading a file from FTP using kettle

I was trying to download a file form FTP server(Remote machine) using pentaho kettle (Get a file with FTP), I can able to do that in my local machine. But when i try to deploy the app in jboss web server it fails to download resulting in a error "Error getting files from FTP : Login incorrect."
But everything seems to be correct regarding the login details.
Did i have configure any where else in the server? Please help.
There are several things you could check in this case:
Check that the security settings of the remote FTP server allows for the machine that runs the job to establish an FTP connection. If you have access to the server, try the following command to ensure that the server has access:
telnet <your-remote-ftp-server-host> 21
# Or try:
telnet <your-remote-ftp-server-host> 22
Verify that the remote FTP server respects FTP connection requests, otherwise try SFTP (Get a file with FTP & Get a file with SFTP are two entirely different job steps in Kettle)
Wherever you are fetching your FTP credentials from (ideally a configuration file), test that the credentials are properly read by the job in the relevant scope - use the Write To Log step for that matter

Ruby NET::FTP Not Resolving Correct IP

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?
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)

Resources