sftp command

Hello folks
i want to know hoaw can i automate sftp command.
When i am execute the script it sftp connect to host and ask for the password but i want password also to be supplied in batfile .It should not ask password on console .

sftp -b batfile user@hostip

Here is how to do it:
sftp runs under ssh, so you need to get ssh passwordless connections going:
ssh-keygen: password-less SSH login

Hello
Cant it be possibe that it can automaticaly read the password from the batfile and than connect

ssh keys provide passwordless access. ssh is NOT designed to allow -b to have a password in the batch file. As you leanred. You can probably find a workaround by writing a daemon with controlling terminal, but why do that? ssh has keyts for the purpose.

IF this does not suit you use ftp, It does allows passwords in a script.

The reason for this - hardcoded passwords are a major security problem.

Have a look a lftp. It supports fully scripted sftp sessions using SSH.