Can you provide instructions on using temporary filename prefix that is removed after the file has been successfully transferred and calculating digest of the original file and the transferred file?
asked Dec 24 '10 at 00:02
SSH KB ♦
Prefix is useful, for example, in setups where the destination directory is polled for specific files and it must be ensured that processing of the file does not begin until it has been completely transferred. Also using the prefix helps to determine easily if the file has been only partially transferred, particularly on the server-side and with ascii file transfers. On client-side digests are recommended to be used to verify binary file transfers have completed successfully. Note that it is important the prefix used is chosen carefully as a file that already exists in the destination directory with the name "prefixfilename" will be overwritten during the file transfer and effectively removed. Following is an example of a simple file transfer setup from SSH Tectia Client host to Tectia Server host. This example assumes some form on non-interactive authentication has been already configured. The first file, sftp-commands.txt, contains the sftp commands which will change the remote directory, print the MD5 hash of a file in working directory on the client-side, upload the file to the server so that during the file transfer the file name in the destination directory is "tmp-file" and finally print the MD5 hash of the transferred file. Contents of sftp-commands.txt: cd relative_directory_to_user_HOME ldigest file put --prefix=tmp- file digest file quit For more information on the available sftpg3 options, please see the sftpg3 man pages. Second file, transfer.bat, will call sftpg3 in batch mode and use the sftp-commands.txt file for sftp commands. Contents of transfer.bat: sftpg3 -B sftp-commands.txt user@tectia_server_f_or_server_t
answered Dec 24 '10 at 00:06
Alan - Tectia Support ♦