Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
cancel
Showing results for 
Search instead for 
Did you mean: 

FTP Scripting Question

Youlette Etienne_2
Regular Advisor

FTP Scripting Question

Hello,

I am building an ftp server using wu-ftp on an e25 11.0 server. I want to write scripts that will automatically ftp files from this server to specific IP addresses outside our firewall. From what I know, to do this, I will have to add the username and password in the scripts, to allow them to log into other servers and transfer the files. I did a search on the Forum and saw the same standard for other ftp scripts. It seems that my only option is to make the scripts rwx by root only. Is there any other option to writing such a script?
If at first you don't succeed, change the rules!
5 REPLIES
federico_3
Honored Contributor

Re: FTP Scripting Question

you should use $HOME/.netrc file that contains login and initialization information used by the ftp autologin process. Its permissions have to be 400.

Check man .netrc

I hope this helps


Federico
Dave Chamberlin
Trusted Contributor

Re: FTP Scripting Question

There is a program called Expect that allows you to make an automated call to programs that normally expect interaction, like ftp. You can make a program as root, set the mode on that program to 4755 ( to allow root ID on execution) and anyone can run it. I believe that Expect is still free to download try
http://expect.nist.gov for some info.
John Palmer
Honored Contributor

Re: FTP Scripting Question

Have a look at this previous discussion on how to hide passwords for use in a shell script.

http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x6ba20559ff7cd4118fef0090279cd0f9,00.html
James R. Ferguson
Acclaimed Contributor

Re: FTP Scripting Question

Hi:

Please see your post and other suggestions in the system administration catetory too.

...JRF...

Re: FTP Scripting Question

Hi,

you should try
ftp -nv < ftpcontrol
command. The "ftpcontrol" file contains all commands that used by the ftp. The control file permissions have to be 400. I send the sample ftpcontrol file, what i use to automatically upload custom pacth information to the HP support site.
Tell me what you need, and I'll tell you how to get along without it!