I am trying to SFTP to a couple sites. One has an RSA-KEY that was sent to me. Currently I am running that manually using WinSCP. I would like to set it up as a CRON process on our Linux host (Sun).
Can I use the rsa-key they sent me in any directory or does it need to be placed in a specific directory? Can someone provide an example of a shell script that authenticates using the key and then "puts" the file on the sFTP host?
My other SFTP host doesn't use keys. I have tried several ways to avoid the password prompt during my shell script. Our system doesn't recognize "spawn" when trying to use a batchfile. Here is an example of what I have now:
<snip>
#!/bin/ksh
CURRENT_DIR=`/usr/bin/pwd`
export CURRENT_DIR
ORACLE_SID=$1 ; export ORACLE_SID
ORAENV_ASK=NO ; export ORAENV_ASK
. /usr/local/bin/oraenv
#
#
sqlplus @szre_export.sql
OUT_DIR=/home/me/AXIO
FILEDATE=`date +%Y%m%d%H%M%S`
chmod 666 $OUT_DIR/szre_extract.txt
chmod 666 $OUT_DIR/szre_extract.txt
umask 026
if [ -s $OUT_DIR/szre_extract.txt ]
then
cp $OUT_DIR/szre_extract.txt szremti_extract${FILEDATE}.txt
chmod 666 szre_extract${FILEDATE}.txt
else
exit 0
fi
#!/usr/local/bin/expect
sftp
myname@connect2ftp.theirhost.net << end_here
expect "password:"
send "secretpass\n";
interact
put szre_extract${FILEDATE}.txt
quit
end_here
exit
<snip>
I have tried several variations, and it continues to prompt for the password.
I appreciate any help here!