j*******r 发帖数: 201 | 1 I just wrote a batch file to download files by ftp like this:
ftp -n 128.104.1.1
user yang yangpwd
ascii
verbose
cd data
get aaa.zip
close
bye
But after being connected, it stopped before verifying username
and password. Can anyone tell me what's wrong?
Thanks a lot, |
w*****n 发帖数: 94 | 2 the ftp program always tries to get username and password from tty,
instead of stdin which can be redirected. the solutions are:
1) put username and password in $HOME/.netrc file, or
2) use expect
【在 j*******r 的大作中提到】 : I just wrote a batch file to download files by ftp like this: : ftp -n 128.104.1.1 : user yang yangpwd : ascii : verbose : cd data : get aaa.zip : close : bye : But after being connected, it stopped before verifying username
|
s*****d 发帖数: 258 | 3 of course it won't work since ftp is an interactive process.
use expect to do this job.
【在 j*******r 的大作中提到】 : I just wrote a batch file to download files by ftp like this: : ftp -n 128.104.1.1 : user yang yangpwd : ascii : verbose : cd data : get aaa.zip : close : bye : But after being connected, it stopped before verifying username
|
j*******r 发帖数: 201 | 4 Here is my .netrc ( username: yang pwd:yangpwd)
"machine 128.10.1.5 login yang password yangpwd"
The problem is when I run ftp 128.10.1.5, it said
Error - .netrc file not correct mode.
Remove password or correct mode.
Can any daxia tell me how to fix this?
Thanks.
【在 w*****n 的大作中提到】 : the ftp program always tries to get username and password from tty, : instead of stdin which can be redirected. the solutions are: : 1) put username and password in $HOME/.netrc file, or : 2) use expect
|
w*****n 发帖数: 94 | 5 make .netrc only readable and writable by yourself.
chmod 600 .netrc
【在 j*******r 的大作中提到】 : Here is my .netrc ( username: yang pwd:yangpwd) : "machine 128.10.1.5 login yang password yangpwd" : The problem is when I run ftp 128.10.1.5, it said : Error - .netrc file not correct mode. : Remove password or correct mode. : Can any daxia tell me how to fix this? : Thanks.
|
c**o 发帖数: 166 | 6 try:
ftp -n > /dev/null <
open 128.104.1.1
user yang yangpwd
bin
cd data
get aaa.zip
bye
EOF
【在 j*******r 的大作中提到】 : I just wrote a batch file to download files by ftp like this: : ftp -n 128.104.1.1 : user yang yangpwd : ascii : verbose : cd data : get aaa.zip : close : bye : But after being connected, it stopped before verifying username
|
j*******r 发帖数: 201 | |