0

I'm trying to use a batch file to download a package off my FTP server.

echo username >ftp.txt
echo >>ftp.txt
echo cd directory  >>ftp.txt
echo get filename >>ftp.txt

ftp -s:ftp.txt server.com

The server is set to allow anonymous logins on username but when I run the script I get an error: 331 Password required for username

If there is any other useful information let me know.

-Alex

Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151
Buzkie
  • 195
  • 4
  • 11

4 Answers4

1

Try "anonymous" as the login and an email address as the password. This is a very old standard for anonymous FTP.

Chris Nava
  • 1,147
  • 1
  • 7
  • 9
  • Only a specific username is allowed anonymous access and it does not require a password – Buzkie Apr 05 '10 at 19:06
  • Then you should be able to provide a script by recreating _exactly_ what is typed when you login via an interactive session. – Chris Nava Apr 05 '10 at 20:45
0

Did you try to begin your ftp.txt with

open server.com

You could use

ftp -s:ftp.txt


EDIT

So I would try, in your ftp.txt

open server.com
username

ftp_commands
bye

Note the blank line after the username.

Luc M
  • 3,110
  • 4
  • 26
  • 27
0

What's the FTP server? Some say "anonymous" log in but still require something to be entered as a password (usually it's looking for an e-mail address) before it will accept the log in. What's the behavior when you connect to the account using a regular FTP client with a blank password?

Justin Scott
  • 8,798
  • 1
  • 28
  • 39
  • When I connect manually I do "FTP server.com" it prompts for user: "username" it says I'm allowed to do anonymous login and asks for a password (suggesting email): "I hit enter" and I'm in – Buzkie Apr 05 '10 at 19:00
0

The trailing space where i was inserting into the textfile was screwing up the login

I removed the spaces and it's letting me in.

Thanks for the suggestions

-Alex

Buzkie
  • 195
  • 4
  • 11