.. _interfaceSFTP: Interface with a SFTP Server ---------------------------- The communication with an SFTP server is automated with a couple integration scripts. Send a File from a Waarp R66 Instance to a SFTP Server ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In this scenario, the file follows the following path: .. uml:: left to right direction rectangle "Site 1" { (server1) } rectangle "Site 2" { (server2) } rectangle "Site 3" { (gwftp) } (server1) --> (server2) (server2) --> (gwftp) (gwftp) --> (serveur sftp) 1. Put a file named :file:`tosftp.file` in the "out" folder of the instance ``server1`` (:file:`/var/lib/waarp/server1/out`). For example, use the command .. code-block:: bash cp /var/lib/waarp/files/test1.file /var/lib/waarp/server1/out/tosftp.file 2. Start the transfer with the command: .. code-block:: bash waarp-r66client server1 send -file tosftp.file -to server2 -rule toSFTP 3. The file is sent to ``server2``, which forwards it to ``gwftp``, before it is sent to the local SFTP server by running the command :program:`/usr/share/waarp/r66-sftp.sh` as a post-transfer task. 4. Once all transfers are done, the file is available in the "in" folder of the SFTP server (:file:`/var/lib/waarp/ftp/sftp/in`). Get a File from a SFTP Server ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In this scenario, the file follows the following path: .. uml:: left to right direction rectangle "Site 1" { (server1) } rectangle "Site 2" { (server2) } rectangle "Site 3" { (gwftp) } :Client sftp: << user >> as sftpclient (serveur sftp) <-- sftpclient sftpclient --> (gwftp) (gwftp) --> (server2) (server2) --> (server1) 1. Put a file named :file:`fromsftp.file` in the "out" folder of the local SFTP server (:file:`/var/lib/waarp/ftp/sftp/out`). For example, use the command .. code-block:: bash cp /var/lib/waarp/files/test1.file /var/lib/waarp/ftp/sftp/out/fromsftp.file 2. Start the transfer with the command: .. code-block:: bash /usr/share/waarp/sftp-r66.sh fromsftp.file It fetches the file from the local SFTP server and automatically forwards it to the destination instance ``server1``. 3. Once all transfers are done, the file is available in the "in" folder of ``server1`` (:file:`/var/lib/waarp/server1/in`).