× 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.



https://github.com/bdietz400/getiptf/blob/master/get_from_FIX_Central.sh#L38-L44

If you want it a bit more readable, you can put the options on separate lines by generating a script and then feeding that whole thing to lftp:

cat <<EOF > lftp-script
set sftp:auto-confirm on
set xfer:clobber on
set xfer:log-file $log_file
set sftp:connect-program "ssh -a -x -o UserKnownHostsFile=/dev/null”
open -u \$s_user,\$u_pwd sftp://$rmt_srv
lcd $lcl_dir
cd $rmt_dir
ls
mirror --verbose --use-pget-n=2 -c --verbose . $lcl_dir
EOF

lftp -f lftp-script

Note that the s_user and u_pwd variables are escaped in there to prevent the credentials being stored in the lftp-script itself.

From: OpenSource <opensource-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Bryan Dietz <bdietz400@xxxxxxxxx>
Date: Wednesday, May 29, 2024 at 2:04 PM
To: opensource@xxxxxxxxxxxxxxxxxx <opensource@xxxxxxxxxxxxxxxxxx>
Subject: [EXTERNAL] Re: [IBMiOSS] Understanding SSH Key Pairs
I tried my hand and the lftp way:
https://github.com/bdietz400/getiptf/blob/master/get_from_FIX_Central.sh

it might give an place to start.

Bryan

Korinne Adler wrote on 5/29/2024 9:03 AM:

As an aside, if you’re trying to automate sftp (especially when using passwords), you probably want to use lftp instead: https://github.com/lavv17/lftp You can pass in the username and password via environment variable instead of only interactively and it supports a batch script file to execute. It’s much easier to work with than sftp for batch stuff. We make available lftp as part of our open source environment: https://ibmi-oss-docs.readthedocs.io/en/latest/yum/README.html


--
This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/opensource
or email: OpenSource-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/opensource .

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.