FTP Error Please log in with USER and PASS first.

linux ftp script that upload files to an local server behind the same firewall, works fine manually but when the script is ran i get the following error  Please log in with USER and PASS first. getting error passive mode refused.


ftp -n -i -p test-ts <<END
user username password
jamar49Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dfkeCommented:
Hi,

usually, ftp command line clients support the configuration file ~/.netrc. There you can configure credentials for remote systems, e.g.:

machine ftp.somesystem.org
login username
password blablabla

When you ftp.somesystem.org then you don't have to retype this information anymore.

Cheers
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Duncan RoeSoftware DeveloperCommented:
ftp -n -i -p test-ts <<END
-n here specifically disables use of .netrc.
I have found I always need to write expect scripts to drive ftp. The documentation contains an example script to drive ftp (or it used to, if not then post back and I can post an example).
0
murugesandinsShell_script Automation /bin/bash /bin/bash.exe /bin/ksh /bin/mksh.exe AIX C C++ CYGWIN_NT HP-UX Linux MINGW32 MINGW64 SunOS Windows_NTCommented:
Forced accept if inactive for 14 days.
0
dfkeCommented:
Hi,

Using  ~/.netrc will solve this issue with the reminder that Duncan Roe gave that -n here specifically disables use of .netrc.

Cheers
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.