Tuesday, November 18, 2008

Shell Script to connect to SFTP

Then connect to your machine and type

$ sftp username@HostName
Connecting to Host...
username@Host's password:
sftp>

if you already created a key pair to not promt for password then you would directly connect to SFTP with out prompting for the password

$ sftp username@HostName
Connecting to Host...
sftp>

Shell Script to connect to SFTP and upload/download files

#vi SFTPupload.sh will open a vi editor to edit/create the shell script
vi SFTPupload.sh
sftp username@hostname EOF
#sftp -b /dev/stdin username@hostname EOF
mput *.*
quit

then enter :wq it will save and comeout of the vi editor

No comments: