FTP script and problem

We have a script where we're trying to ftp to an outside ftp server, but it keeps failing with the error:
421 Service not available, remote server has closed connection

if we ftp <server> and manually enter the username and password from the Unix box it's just fine.

But when we try to use the ftp script to run:

ftp -n -i -v <<EOF
open <server>
user <username> <password>
ascii
ls
quit
EOF

We get the: 421 Service not available, remote server has closed connection

Any ideas?

Thanks, Jeff

Try using "$HOME/.netrc" to set up the password rather than including it in the script.

Your ftp should really read a password from /dev/tty rather than stdin.