1833785 Members
2871 Online
110063 Solutions
New Discussion

shell script Help

 
Nick D'Angelo
Super Advisor

shell script Help

I need to modify a shell script and I need your help please.

ftp proxy.domain.com
echo "anonymous@ftp.ncib.nlm.nih.gov\n"

My problem is this. the first ftp.proxy.domain.com command works, but then I need to enter the next line automatically in my script. It appears that it is not accepting the anonyous@ftp.... portion. Am I missing a or something else?
Always learning
7 REPLIES 7
RAC_1
Honored Contributor

Re: shell script Help

It will not work that way. FTP is not designed that way

ftp some_host << EOF

user username password
cd
get xxx
close
bye

EOF

OR put your user_name and pass in .netrc file. OR

user_name=user_name
Password=pass

ftp -inv host_name << EOF
user $user_name $Password

your_stuff here..

EOF

A better way--setup ssh

Anil
There is no substitute to HARDWORK
Abdul Rahiman
Esteemed Contributor

Re: shell script Help

This script should do what you are looking for,

ftp -n << EOF
open ftp.ncib.nlm.nih.gov
prompt
quo "user anonymous"
quo "pass "myname@email.com"
ascii
<>
quit
EOF

HTH,
Abdul.
No unix, no fun
Nick D'Angelo
Super Advisor

Re: shell script Help

gents, Thanks, however.

The first ftp is to our outgoing Proxy server, then I need to pass the username and password to the actual ftp server:

user anonymous@ftp.ncib.nlm.nih.gov
pass nickd63@nickd.com

Always learning
Michael Schulte zur Sur
Honored Contributor

Re: shell script Help

Hi,

have you tried it this way?

ftp -in proxy << EOF
user proxyuser proxypasswd
user ftpuser@ftphost ftppasswd
ftpcommands
bye
EOF

greetings,

Michael
Fred Ruffet
Honored Contributor

Re: shell script Help

have you tried to set ftp_proxy env variable ?

export ftp_proxy=ftp://user:pass@my.ftp.proxy
ftp host.to.reach << EOF
user myuser mypass
get it all
bye
EOF

regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Nick D'Angelo
Super Advisor

Re: shell script Help

neither of these last solutions work.

Note:

if I am doing a 'manual' ftp, this is what I type.

ftp outgoing.proxy.com

Then, I need to put in the actual userid and destination ftp site/location.

userid@destftp.com

Then, I need to put in my destination site password.



Always learning
Jose Mosquera
Honored Contributor

Re: shell script Help

Hi,

Pls take a look a lftp product into http://lftp.yar.ru/

After download and install it, create a ftp commands file, i.e:
#cat my_ftp_commands_file.ini
set ftp:proxy "http://:@:"
set http:proxy "http://:@:"
open -u ,
dir


Then execute:
#lfp -f my_ftp_commands_file.ini

To detailde info:
#man lftp
-or-
#lftp
lftp :~>help

Other interesting product could be http://hpux.connect.org.uk/hppd/hpux/Networking/FTP/ncftp-3.1.4/

Pls chk it!

Rgds.