How do I use SSH to securely transfer large files?

Published on Aug. 22, 2023, 12:18 p.m.

To securely transfer large files using SSH, you can use the scp (secure copy) command. Here’s an example command to transfer a file from your local machine to a remote server:

scp /path/to/local/file username@remote:/path/to/destination

Replace username with your remote server login username, remote with the server’s IP address or hostname, and /path/to with the appropriate file paths. The command will prompt you to enter your remote server login password (if applicable) and transfer the file securely.

Another option for securely transferring large files using SSH is to use rsync, which has the advantage of being able to resume failed transfers and to only transfer changed parts of files. Here’s an example command for transferring a directory using rsync:

rsync -avz /path/to/local/directory username@remote:/path/to/destination

Again, replace username, remote, and /path/to with appropriate values, and enter your remote server login password as prompted.

Both scp and rsync use SSH as the underlying transport, which encrypts both your authentication information and the data itself, ensuring secure transfer of your files.

Tags: