Batch file for sftp commands

I am trying to automate an sftp command so that it does not stop and ask for the password each time

the calling shell script

#!/bin/ksh 
sftp -b tst_1_batchfile.txt GLAXGBUPMPSOUT@204.90.134.116 

the batchfile contents :

password XXXXXX
cd /GLAXGBUPMPSOUT/GSKENT/GLAXGF2FOPFF 
put Intgrchn_844.txt.gz.enc 
quit 

, but I keep getting this error :

Please login with user ID and password. 
Permission denied (publickey,password). 
Connection closed 

thanks
SB

sftp reads the password from /dev/tty, so you need a tool that creates a psuedo tty like expect or even ssh localhost. It is better to set up the keys and not have any password, usually.

Why not use non-interactive authentication (ie public/private keys), check manual on sshd and ssh-keygen.

If that isn't a option how about rsync you can us --password-file param or RSYNC_PASSWORD env var.

As a basic primer read the following here goto the section Creating an RSA key for SSH v2 Protocol :b:

Yes, you need to google around for the steps, so you create the right .ssh/.ssh2 subtree, a personal public-private key set, and then in first test (I use: ssh/ssh2 localhost pwd) it will ask if you want to save host keys, yes. When generating the keys, ask for as much length as is allowed, and give no password or you are back up the creek! Once you get localhost/127.0.0.1 working, 'scp -pr' the whole .ssh/.ssh2 subtree to a second host using your password and see if, without a password, you can ssh/ssh2 that_host pwd. My .ssh dir is not even .ssh, it is /etc/ssh2/auth/$LOGNAME because my $HOME is the same mount everywhere, so $HOME/.ssh2 will not work. If you cannot run ssh2 for some petty and short sighted reason, the directory and commands lose the 2.