Browse Source

added sftp with password to copy files

pull/42/head
agp8x 10 years ago
parent
commit
0f67e734ed
1 changed files with 17 additions and 0 deletions
  1. +17
    -0
      getssl

+ 17
- 0
getssl View File

@ -400,6 +400,23 @@ copy_file_to_location() { # copies a file, using scp if required.
lcd $fromdir
put $fromfile
_EOF
elif [[ "${to:0:5}" == "sftp:" ]] ; then
debug "using sftp to copy the file from $from"
ftpuser=$(echo "$to"| awk -F: '{print $2}')
ftppass=$(echo "$to"| awk -F: '{print $3}')
ftphost=$(echo "$to"| awk -F: '{print $4}')
ftplocn=$(echo "$to"| awk -F: '{print $5}')
ftpdirn=$(dirname "$ftplocn")
ftpfile=$(basename "$ftplocn")
fromdir=$(dirname "$from")
fromfile=$(basename "$from")
debug "sftp user=$ftpuser - pass=$ftppass - host=$ftphost dir=$ftpdirn file=$ftpfile"
debug "from dir=$fromdir file=$fromfile"
sshpass -p $ftppass sftp $ftpuser@$ftphost <<- _EOF
cd $ftpdirn
lcd $fromdir
put $fromfile
_EOF
else
mkdir -p "$(dirname "$to")"
if [ $? -gt 0 ]; then


Loading…
Cancel
Save