Tuesday, September 17, 2013

How to set up non-interactive SFTP using bash/sh script

Following is how you can non-interactively use SFTP in bash

-----------------------------------------------------------------------------------------------
 #!/bin/sh


# Setup credentials
HOST='ftp.abc.com'
USER='username'
PASS='password'

lftp -u ${USER},${PASS} sftp://${HOST} <<END_OF_SFTP
cd dir
get file
bye
END_OF_SFTP
-----------------------------------------------------------------------------------------------

No comments:

Post a Comment