Active Managed File Transfer Through Remote SSH Execution
Many MFT solutions are working on a passive model, which serves as a file hub for business partners to push data and take action on received data based on predefined criteria. The solution has to make itself generic to cover as many scenarios as possible, making it inevitably complex and costly. In this article, we introduce a simple technology backed by TurboFTP, i.e. SSH remote execution, to achieve the same goal in some cases but more cost-friendly and with less resource footprint.
- File transfer is done over SFTP.
- The remote SSH Server supports SSH Channel Requests of command execution, for example, the open-source OpenSSH Server and SSH.com's Tectia SSH Server.
- You are authorized to execute a shell command on the server.
- The triggered processes can be accomplished by executing command-line programs on the remote server.
Set Up SSH Remote Execution
Suppose we regularly back up a MySQL database called transaction on the remote Linux server.
- First, we create an SFTP scheduled task with Download as the Synchronization Direction and enter *.gz as inclusion file filters to download the exported database backup copy.
- Second, we need to fill in the following command in the Before task (R) field to export the MySQL database to a compressed archive.
- Lastly, we fill in a command line in the After task (R) field to delete the downloaded file.
cd $HOME/backup; mysqldump --no-tablespaces -udbuser --password='dbpass' transaction > transaction_$(date +"%Y_%m_%d_%I_%M_%p").sql.gz
The above commands assume that you use a bash shell. You can test-drive the task by pressing the 'Run Now' button. If it completes successfully, you will have a compressed backup of the database (e.g. transaction_2022_11_17_08_27_AM.sql.gz) downloaded in the specified local folder.
You can do anything as you would on the Linux/Unix command prompt. You can execute a shell script or a script in other languages like Python, Go, etc., with vast libraries or extensions for your need. For example, you can send Emails, delete or move local files, and upload files to cloud storage like Amazon S3 (with just a few lines of code).
Since many organisations have adopted SSH protocol to exchange data securely, it is becoming a significant standard for secure file transfer. SFTP over SSH provides the security that helps meet compliance standards like HIPPA, PCI DSS, etc. Turbo FTP client offers a cost-efficient approach to implement managed file transfer with its support of SSH remote execution.
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.