How to Transfer Files Securely Between Servers Using Rsync over SSH

  • Home
  • VPS Hosting
  • How to Transfer Files Securely Between Servers Using Rsync over SSH

Forget FTP: The Faster Way to Move Data

If you are still using FTP to transfer large files between servers, you are doing it the hard way. FTP is often slow, insecure, and unreliable for large migrations.

Meet Rsync. It stands for “Remote Sync,” and it is the industry standard for transferring files efficiently. When combined with SSH, it ensures your data is encrypted during transit. This is the preferred method for migrating websites to a new Linux VPS.

Planning a Server Migration?
Don’t let a slow server hold you back. Move your data to WPressly’s high-speed cloud infrastructure today.
Get a High-Speed VPS Now

Why Rsync over SSH?

  • Speed: It compresses data (`-z`) before sending it.
  • Efficiency: If the connection drops, Rsync can pick up exactly where it left off.
  • Security: By tunneling through SSH, your files are protected from prying eyes.

Basic Syntax

The basic command structure looks like this:

rsync [options] -e ssh /source/directory user@remote_ip:/destination/directory

Scenario 1: Uploading Files (Local to Remote VPS)

Let’s say you want to upload a website backup from your computer to your new WPressly VPS. Open your terminal and run:

rsync -avz -e ssh /home/user/my-website.zip root@192.168.1.1:/var/www/html/

Breakdown of flags:

  • -a: Archive mode (preserves permissions and timestamps).
  • -v: Verbose (shows you the progress).
  • -z: Compresses data for faster transfer.
  • -e ssh: Tells rsync to use the SSH protocol.

Scenario 2: Downloading Files (Remote VPS to Local)

If you want to download a log file or backup from your server to your local machine:

rsync -avz -e ssh root@192.168.1.1:/var/log/nginx/access.log /home/user/logs/

Pro Tip: Show Progress Bar

Transferring a huge file? Add the --progress flag to see a progress bar and estimated time remaining:

rsync -avz --progress -e ssh /local/file user@remote_ip:/remote/dir

Conclusion

Rsync is a powerful tool that every system administrator should master. It makes server migrations and backups a breeze.

Ready to host your data on a reliable platform?