• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 405
  • Last Modified:

Store password in ftp file

Hello,

I am trying to get the password to store into this ftp file but cannot accomplish this.
Can someone assist me on this?

@echo off
setlocal

REM Prompt user for file name
set /P File=Please enter filename to transfer:
if "%File%" EQU "" (
  echo ERROR - No filename specified.
  exit /b
)

REM FTP file
(
  echo open 10.10.10.120
  echo user user  
  echo password password
  echo lcd c:\temp
  echo cd /home/user
  echo get %File%
  echo quit
) | ftp -n -i

I tried to add 'echo password password but it still prompts for the password.
Tried using the set command but still get prompt for the password.

Any help would be appreciated.

Thank you.
0
cbones
Asked:
cbones
  • 2
  • 2
1 Solution
 
paultomasiCommented:
Try adding/changing the following...

Add this line near the top of your batch file. Replace '<your password>' with your ftp password (don't include the '<' and '>' characters):

set password=<your password>

then change the line 'echo password password' to:

echo password %password%
0
 
paultomasiCommented:
or, omit the word 'password' and just echo your ftp password, like this:

echo <password>

where '<password>' is your ftp password. (don't include the '<' and '>' characters).
0
 
Bill PrewCommented:
You might want to try this as well:

  echo quote user myuser  
  echo quote password mypassword

~bp
0
 
Bill PrewCommented:
You can also try replacing:

  echo user user  
  echo password password

with:

  echo user myuser mypassword

~bp
0
 
Steve KnightIT ConsultancyCommented:
Guess you've got that one covered :-)

I normally find either just the password on line by itself or after username are most likely combinations. Got these here:

 http://scripts.dragon-it.co.uk/links/batch-ftp-scripting

Steve
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now