JeepGeekin
asked on
FTP Batch File Password issue
I have read through a few scripts for simple Unattended FTP scripts that doesn't require additional applications, but I can't seem to get the server that I am logging into to accept the password.
The following script successfully logs into the ftp server & accepts the login, but I can't seem to get it to recognize the password. I am executing this from Windows 2003 Server connecting to a sun64 FTP server if this helps.
BAT File Code:
ftp -s:ftpparams.txt
PAUSE
The ftpparams.txt File Code:
open ftp.dnb.com
user {userID} {password}
cd gets
get {filename}
bye
Note: I replace {password} & {username} with the actual id & password without the brackets.
I have also tried putting the password on the second line (which was a reach). I tried pass {password}, password {password}, /{password}. No luck. Does anyone see a problem or have an idea on what to try? I would like to keep this in a batch file & not have to install 3rd party tools unless it's required. Other people have been able to get this to work. I imagine that I should be able to as well.
Thanks!
The following script successfully logs into the ftp server & accepts the login, but I can't seem to get it to recognize the password. I am executing this from Windows 2003 Server connecting to a sun64 FTP server if this helps.
BAT File Code:
ftp -s:ftpparams.txt
PAUSE
The ftpparams.txt File Code:
open ftp.dnb.com
user {userID} {password}
cd gets
get {filename}
bye
Note: I replace {password} & {username} with the actual id & password without the brackets.
I have also tried putting the password on the second line (which was a reach). I tried pass {password}, password {password}, /{password}. No luck. Does anyone see a problem or have an idea on what to try? I would like to keep this in a batch file & not have to install 3rd party tools unless it's required. Other people have been able to get this to work. I imagine that I should be able to as well.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the posts. I have tried all of the recommendations and I get the response "Login failed for userID" (except it does state the correct userID I gave it. The userID seems to be getting through, just not the password....and I hand typed it about 20 times today and know I am using the correct ID & password.
Thanks for the variation JJT2750, but for troubleshooting I wanted to mention that it recognized the userID as "user=userid" (again userid being the actual id that we use). I tried the password the way you have it and tried:
user {username}
{password}@dnb.com
I thought this might work, but I got the same login error mentioned above. Also, just to mention it I can manually perform a successful login using the same login info I am trying to pass it from a command prompt on the same server. That rules out some basic issues.
I'm at a loss. Anyone have any other ideas? Possibly there is a different way to communicate with this type of server?
Thanks for the variation JJT2750, but for troubleshooting I wanted to mention that it recognized the userID as "user=userid" (again userid being the actual id that we use). I tried the password the way you have it and tried:
user {username}
{password}@dnb.com
I thought this might work, but I got the same login error mentioned above. Also, just to mention it I can manually perform a successful login using the same login info I am trying to pass it from a command prompt on the same server. That rules out some basic issues.
I'm at a loss. Anyone have any other ideas? Possibly there is a different way to communicate with this type of server?
You need to type userid and password exactly as you are using with manual FTP command.
All you need to do is to initiate FTP from command prompt manually.
Then, if you are able to login then just use same userid and password.
You can try and create this script for some other FTP site. e.g ftp.cdrom.com
See if it works.
I think it the correct.
All you need to do is to initiate FTP from command prompt manually.
Then, if you are able to login then just use same userid and password.
You can try and create this script for some other FTP site. e.g ftp.cdrom.com
See if it works.
I think it the correct.
ASKER
OK. I tried to run this from a XP Pro box and 2000 box and my initial code worked fine on both.
The culprit is Windows 2003 server. The FTP utility shipped with 2003 Server must take different commands. Command line help doesn't cover the parameters for the password & user ID (other then telling me to put them in a seperate parameter file). I can look it up now that I know the problem, but if anyone knows the code that should be used for 2003 server, please post for others that may read this.
Thanks for your help guys.
The culprit is Windows 2003 server. The FTP utility shipped with 2003 Server must take different commands. Command line help doesn't cover the parameters for the password & user ID (other then telling me to put them in a seperate parameter file). I can look it up now that I know the problem, but if anyone knows the code that should be used for 2003 server, please post for others that may read this.
Thanks for your help guys.
Hey, this indeed is a news.
Will check it up.
Thanks.
Will check it up.
Thanks.
ASKER
OK. I got it working (Microsoft not being a help).
For 2003 server, remove the word "user" for the user ID & add the password to the second line in the parameter file.
The following will work on WINDOWS 2003 SERVER (and also worked on XP). Make sure you don't use the keyword "user" in your parameter file:
BAT FILE CODE:
ftp -s:ftpparams.txt
PAUSE
Parameter File Code:
open ftp.dnb.com
{userID}
{password}
cd gets
get {filename}
bye
For 2003 server, remove the word "user" for the user ID & add the password to the second line in the parameter file.
The following will work on WINDOWS 2003 SERVER (and also worked on XP). Make sure you don't use the keyword "user" in your parameter file:
BAT FILE CODE:
ftp -s:ftpparams.txt
PAUSE
Parameter File Code:
open ftp.dnb.com
{userID}
{password}
cd gets
get {filename}
bye
Didn't work for me with many unattended batches broken. Worked for years but now password has trouble being passed in as any of the following;
USER userID password
userID
password
userID
password@ourdomain.com
results
530 Login or password incorrect!
Login failed.
USER userID password
userID
password
userID
password@ourdomain.com
results
530 Login or password incorrect!
Login failed.
--------------------------
open 11.11.11.11
user <------------Keyword
guest <------------UserID
guest <------------password
put file1
quit