× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



In this case he is using the tool "expect" to signon using user/password. Whe using SFTP, part of SSH protocol, the best practice is using shared keys, so you can use passwordless logon. SFTP command can't use password on scripts.

In my case, when I need to exchange user & password I use "lftp" , an open source tool with similar sintax, but accepts passwords when scripted.

A tipical sftp call looks like this:

sftp -b /sftp/sftpscript.sftp myuser@mysftpserver

and sftpscript.sftp content looks somethin like this:


cd /home/gio
get myfile.txt
rm myfile.txt
quit


Take a look at Scott's "Scripting the OpenSSH, SFTP, and SCP Utilities on i"
https://www.scottklement.com/presentations/Setting%20up%20and%20Scripting%20the%20OpenSSH,%20SFTP%20and%20SCP%20Utilities%20on%20IBM%20i.pdf

Regards


Diego Kesselman


El 29/09/17 a las 10:16, gio.cot escribió:
Hi Kevin


Thanks for your reply ..


Sorry but i have not understand your script


#!/usr/local/bin/expect -f
spawn sftp -oPort=9002 user@67.136.124.49
expect "password:"
send "notthepassword"
expect "sftp>"
send "cd current\n"
expect "sftp>"
send "mget *\n"
expect "sftp>"
send "quit\n"


I can run this ?? if I want write a CLP (for now I can also hardcode user
and pass) that run a get from sFTP server , where can find an example. For
now that , I'm in test, I would not use (if possible) public key


Thanks



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.