I have the following bash script(related to ftp) that read the parameters from the properties file and then transfer some files to the remote machine...
following is the bash script ....
#!/bin/sh
. ftp.properties
ftp -vin >> ftp.log <<-!
open $RemoteIp
user $userid $password
cd $DestFolder
lcd $SrcFolders
put $SourcefilePattern
bye
!
Now in the above scripT, I am using ftp what if I cahange the ftp in the Sftp...what effect would it bring...please guide me on that..!!
I think you cannot supply password in batch (non-interactive) mode in SFTP (unless you are using automation tools like expect see (How To Expect | Linux Magazine). I would think you would be much better off using key based password-less authentication (see Password-less logins with OpenSSH).
sftp is an interactive file transfer program, similar to ftp, which performs all operations over an encrypted ssh transport. It may also use many features of ssh, such as public key authentication and compression. sftp connects and logs into the specified host, then enters an interactive command mode.
The second usage format will retrieve files automatically if a non-interactive authentication method is used; otherwise it will do so after successful interactive authentication.
The third usage format allows sftp to start in a remote directory.
The final usage format allows for automated sessions using the -b option. In such cases, it is necessary to configure non-interactive authentication to obviate the need to enter a password at connection time