1822430 Members
2966 Online
109642 Solutions
New Discussion юеВ

FTP without Password

 
SOLVED
Go to solution
Virumandi
Frequent Advisor

FTP without Password

Hi ,

I am uploading files to my server from my windows machine using ftp.

It want to create a batch file and when i run it from my windows machine it automatically copy the files to the FTP server without asking the password.

My query is,

How can i send the password to my ftp server while i am running a batch file..
I dont want to do it manaully , I want to enter the password in my script, such that the ftp upload operation start automatically.

Anybody guide me how to do it...

Regards
Suseendran .A
7 REPLIES 7
Peter Godron
Honored Contributor
Solution

Re: FTP without Password

Hi,
on the windows machine create a .bat file with:
echo user USERID PASSWORD > a.lis
echo ls >> a.lis
echo bye >> a.lis
ftp -n -d -s:a.lis IPADDRESS
del a.lis


NOT recommened way, as it gives you a security problem:
On the UNIX machine
edit $HOME/.netrc
machine login password
chmod 700 $HOME/.netrc

You should then be able to ftp directly.
Yogeeraj_1
Honored Contributor

Re: FTP without Password

hi Suseendran,

also consider using secure FTP also known as sftp.

It may also use many features of ssh, such as public key authentication and compression.

it is more secured.

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Virumandi
Frequent Advisor

Re: FTP without Password

Hi.,

I accept your words that sftp is more secure and fast when compare to ftp.

But when i give sftp command from my system it is giving the error message "command not found"

Can u tell me , whether sftp will work in windows , if so how can i came out of the issue.


Regards
Suseendran .A
Peter Godron
Honored Contributor

Re: FTP without Password

rmueller58
Valued Contributor

Re: FTP without Password

I use expect scripting to perform promptless FTP from Cron.

1st I have a perl/sed script that modifies the TEMPLATE Below:
Specifically FILE the USERNAME and PASSWORD are embedded in the expect script. (if you have security concerns I'd opt for batch mode SFTP where you've exchanged keys.

#!/usr/bin/expect
spawn ftp 10.3.253.6
expect "Name"
send "USERNAME\r"
expect "Password:"
send "PASSWORD\r"
expect "ftp> "
send "lcd /home/xfer\r"
expect "ftp> "
send "cd /tmp/xfer\r"
expect "ftp> "
send "ascii\r"
expect "ftp> "
send "put FILE\r"
expect "ftp> "
send "quit\r"
Peter Godron
Honored Contributor

Re: FTP without Password

Hi,
could you please update this thread.
If the problem is resolved, please award points and close stating solution.
Virumandi
Frequent Advisor

Re: FTP without Password

Hi .,

Thanks to all
Now It is working fine.