Solved Automated SFTP Script

July 6, 2005 at 02:23:12
Specs: Sun Solaris, 512 MB

I am trying to create a new script which needs to upload/download files by using SFTP protocol. For that, I would like to automate that script. I know that sftp command is having a option to process those commands in a batch file by using -b option.

I tried as follows:

sftp -bmybatfile username@host

In mybatfile:
get *.lst

While running the command, it is asking for password. But, I already mentioned the password in the batchfile. Since I need to connect some other external server's SFTP, it is hard to get the authentication key and install the same in my box. So, can you guys let me know what is the problem with the script?

Thanks in advance


See More: Automated SFTP Script

Report •

July 11, 2005 at 11:54:12
✔ Best Answer

1. -b batchfile
Batch mode. Reads commands from a file instead of standard input.
Since this mode is intended for scripts/cronjobs, sftp2 will not
try to interact with user, which means that only the passwordless
authentication methods will work. In batchmode, a failure to
change the current working directory will cause the sftp2 to
abort. Other errors are ignored.

2. Sftp uses ssh2 in data connections,
so the file transport is secure.

3. So, set up ssh according to your ssh version to remove the need to interactively input the username and password.

Luke Chi

Report •

August 31, 2005 at 12:14:13

We have a product SFTPPlus designed for this purpose. Check


Report •

Related Solutions

Ask Question