You have some options other than using the public key authentication:
- Use keychain
- Use the sshpass (less secured but probably that meets your requirement)
- Use except (least secured and more coding needed)
If you decide to give sshpass the chance here is the working script snippet to do so:
export SSHPASS=your-password-here
sshpass -e sftp -oBatchMode=no -b - sftp-user@remote-host << !
cd incoming
put your-log-file.log
bye
!
Want to be a Linux expert? Come and join this Linux course