Re: How to transfer data remotely to PCs in LAN via SFTP?



"Ahmad" <ahmad.abdulghany@xxxxxxxxx> writes:
Hi,

I want to automate transferring file or folder to 20 PCs connected via
the same LAN..

The problem i face is that they need to enter password and i don't
know how to pass it in the code syntax..

Sample Code:
for i in (1:20) # 20 PCs
do
sftp user(at)10.0.0.$i # to log-in remotely to PCs one by one
# Password should be entered here!! How to ??
put $file ; # transfer the file to destination PC
exit # come back to current shell
done # will go to log-in to the next PC

I want to either override password promot, or find a way to pass it
automatically to the standard input ..

Did you try to:

echo "secret_password" | sftp user@...

?
.



Relevant Pages