Jim,
Thanks for your reply. We have generated keys on both the source and destination machines authenticating the user. We are running the script from this user. If I type it manually from a command prompt "TestSFTP.sh", it works fine. However when I put it in cron it doesn't.
As a further test, I put in an additional line in cron to send me an email.
#!/bin/ksh
mailx -s "Test"
myemail@myemail.com < /path/TestSFTPcron.txt
cd /localpath
sftp remotename@remotehost:/remotepath <<EOF
mput Test.txt
bye
EOF
When I do this, it also works completely fine when I run it manually. However, in cron I so receive the email but the file is not put on the remote machine.
It looks like the script is partially working...