Unix / Linux: sftp File From One Server To Another

Unix / Linux: sftp File From One Server To Another

To transfer a file from one server to another using sftp, you will need to use the sftp command-line client and specify the source and destination servers and paths.

sftp is a secure file transfer protocol that allows you to transfer files between computers over an SSH connection.

To transfer a file from one server to another using sftp, you can use the following syntax:

refer to‮tual:‬turi.com
sftp user@source:/path/to/file user@destination:/path/to/destination

Replace user with the username on the source and destination servers, source with the hostname or IP address of the source server, and destination with the hostname or IP address of the destination server. Replace /path/to/file with the path to the file on the source server and /path/to/destination with the destination path on the destination server.

For example, to transfer the file /tmp/file.txt from the source server source.example.com to the destination server destination.example.com, you can use the following command:

sftp user@source.example.com:/tmp/file.txt user@destination.example.com:/tmp/

This will transfer the file from the source server to the destination server and save it in the /tmp directory.

You can also use the -r option to transfer directories recursively:

sftp -r user@source.example.com:/data/ user@destination.example.com:/data/
Created Time:2017-10-30 14:27:30  Author:lautturi