SFTP command in Bash script with Mac OS X
10,443
Solution 1
You can download and install sshpass on Mac as well. Get the latest version source from this download link
Rest of the steps on using sshpass are there in the linked answer of mine.
Solution 2
lftp
is great for scripting ftp (and sftp, ftps). And you can install it with brew:
brew install lftp
Author by
Tiit Remmel
Updated on June 04, 2022Comments
-
Tiit Remmel almost 2 years
I need to transfer a text file to a remote PC (freeSSH) using SFTP and SSH from a Mac host. These two are connected in a local network.
So is there a way to run an SFTP command (with the username and password provided) from inside the Bash script?
I already tried some scripting with
expect
, but I didn't get any results.I found a similar post, How to run the sftp command with a password from a Bash script, but it is for Linux. I have a Mac.