I need to connect to multiple SFTP connections and copy files to my system.
I will maintain one CSV file in our local system. It will have multiple partners' information of username, password, hostname, port, and inbox folder path.
ex : partner1 | user1 | password1 | hostname1 | port1 | inbox path| outbox path| partner2 | user2 | password2 | hostname2 | port2 | inbox path| outbox path|
In my Unix script, I need to prepare SFTP commands, to login into partner1's SFTP connection and get all the files and move into outbox path. Once partner one's file transfer completes, the script should prepare the next partner's SFTP commands for the file move.
How to set SFTP command in script?
ssh -oport username@hostname --> after that how to set password command
NOTE: Some partners have privatekey based authentication and some have public based authentication. How to implement logic in script for these private and public key based authentication.