Creating an automated FTP process on RH Linux

I know this quetion has been asked before, but I cannot find a solution that works.  Here are the essential facts and requirement:

1. I must use FTP.  I know it's not secure, but this is an internal network where security is not an issue.
2. The script must run from RH Linux
3. The connection is to a NAS device that supports FTP
4. The FTP session must be able to be scheduled and run unattended.

I have tried a variety of scripts, but always get "stuck" when FTP requests a password.  For example, I have tried:

ftp < myscript

where myscript is:


just to test out the basic process.  I have also tried variations like USER annymous, but it is always the same - FTP prompts for a password.  This is probably simple, but I'm not getting anywhere.  Could someone please help?  Thanks in advance!

Who is Participating?

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

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.

The client you did not find is called ncftp.
First of all install rpm-build package
Then download client from
Then use rpmbuild against source tarball to make it into rpm package
Then rpm -i ncftp*.rpm
Now use either ncftp tp save profile and anyway ncftpget/put command line to transfer files.

To correct your script - ftp -ni typefile is much better than ftp < typefile
dkreinesAuthor Commented:
Thanks for the response, but it really doesn't address my problem, because I MUST use ftp; loading a different program is not an option.  The real problem is that I cannot get ftp to accept a password from a script.  Maybe this is harder than I thought.
try this way

 ftp -n <<endftp
  user youruser yourpassword

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
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

if you cannot use ncftp or any other ftp which allows what you need, you need to write a script using expect (simple) or perl (more complicated). But if  "loading a different program is not an option" you loose.
> 1. I must use FTP.  I know it's not secure, but this is an internal network where security is not an issue.
> 2. The script must run from RH Linux
> 3. The connection is to a NAS device that supports FTP
> 4. The FTP session must be able to be scheduled and run unattended

Where the hell is that you have to use /usr/bin/ftp from random redhat revision, probably not even enough functional to fetch files from your NAS ???

Sorry - /usr/bin/ftp alone is insufficient to your task.

ncftpget and ncftpput are tools that do what you described to my best understanding - up/download files without user interaction using FTP - file transfer protocol.

dkreinesAuthor Commented:
Thank you, Bira - your solution was perfect.  I had tried various similar forms, but didn't realize that the password went on the same line as the username.  I now have a perfectly functioning scriot (which of course does much more than the trivial sample I used here).  Contrary to the comment by gheist, ftp IS sufficient for this task!  Thanks again.

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
Unix OS

From novice to tech pro — start learning today.