Table of Contents

Transferring files via SFTP

Linux

Using TMSS10SFTP

The TMSS10SFTP program is installed by default with the TapeTrack Command Line Programs for Linux.

This program provides more automation that the native sftp command and is able to automatically select the newest file in a directory.

This comes in handy when downloading files from Iron Mountain as they only provide time-stamped files requiring the user to know the name of the file to be downloaded in advance.

Documentation for TMSS10SFTP can be found here.

Using sshpass and sftp

The Linux sftp command does not provide an argument to specify a password. If you do not want to configure keys for the transfer, you can install the sshpass program.

[root@corp-01 ~]# yum install sshpass
Last metadata expiration check: 0:04:14 ago on Fri 19 Apr 2019 04:22:49 PM MDT.
Dependencies resolved.
=========================================================================================================================================================================================================================================
 Package                                                 Arch                                                   Version                                                     Repository                                              Size
=========================================================================================================================================================================================================================================
Installing:
 sshpass                                                 x86_64                                                 1.06-4.fc27                                                 fedora                                                  26 k
 
Transaction Summary
=========================================================================================================================================================================================================================================
Install  1 Package
 
Total download size: 26 k
Installed size: 38 k
Is this ok [y/N]: y
Downloading Packages:
sshpass-1.06-4.fc27.x86_64.rpm                                                                                                                                                                           1.4 MB/s |  26 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                    196 kB/s |  26 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                 1/1 
  Installing       : sshpass-1.06-4.fc27.x86_64                                                                                                                                                                                      1/1 
  Running scriptlet: sshpass-1.06-4.fc27.x86_64                                                                                                                                                                                      1/1 
  Verifying        : sshpass-1.06-4.fc27.x86_64                                                                                                                                                                                      1/1 
 
Installed:
  sshpass.x86_64 1.06-4.fc27                                                                                                                                                                                                             
 
Complete!

Once sshpass is installed, you can call sshpass, pass the password and then pass the sftp command string as an argument.

To specify multiple command strings you can either pass a file fill of commands, or you can use the bash here-string syntax.
[root@corp-01 ~]# sshpass -p "password" sftp user@server.tapetrack.com <<< "put drm.csv upload/drm.csv"
Connected to server.tapetrack.com.
sftp> put drm.csv upload/drm.csv

Windows

Windows users wanting to send files via SFTP can use the TMSS10SFTP command (installed as part of the TapeTrack Server Utilities package), or a third-party program such as WinSCP.