This guide walks you through setting up and using rsync on a Windows system by leveraging WSL (Windows Subsystem for Linux) and a Linux distribution (like Ubuntu). rsync is a powerful command-line tool for copying and synchronizing files across systems — especially useful when working over SSH to a remote server.
Prerequisites
- A Windows 10 or 11 system with WSL support
- Administrative privileges (to install WSL)
- Internet connection
- Basic familiarity with the command line
Step 1: Install WSL
- Open PowerShell as Administrator
- Run the following command to install WSL (and default Linux distro):
wsl --installThis installs the latest version of WSL and a default Linux distribution (usually Ubuntu). You may need to reboot afterward.
If WSL is already installed, you can check your installed distributions by running:
wsl -l -v
Step 2: Install a Linux Distribution (Ubuntu Recommended)
If WSL didn’t automatically install a distro, or if you want a specific version:
- Open the Microsoft Store
- Search for Ubuntu
- Choose a version (e.g., Ubuntu 24.04.1 LTS) and click Install
After installation:
- Launch Ubuntu from the Start menu
Step 3: Update Ubuntu and Install rsync
Once Ubuntu is open, run the following to fully update the environment and install rsync.
🧹 Update Ubuntu:
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt autoremove
- You’ll be prompted for your password.
- These commands update your package list, install the latest updates, and clean up old packages.
🔧 Install rsync:
sudo apt install rsync
rsyncshould now be available for use!
Step 4: Using rsync with SSH to Transfer Files
Here’s the basic syntax to transfer files from your WSL environment to a remote server:
rsync -avz full_path_to_source -e "ssh -l username" server_address:full_path_to_destination
Parameters Explained:
-a: archive mode (preserves permissions, timestamps, etc.)-v: verbose output-z: compress data during transfer-e: specifies the remote shell to use (in this case,sshwith a specific login user)
Example
Let’s say:
- Your local folder is
/home/dpane/testData - Your remote server is at
128.2.244.19 (which is raptor.ni.cmu.edu) - Your remote username in this example I will use:
dpane - You want to copy to
/home/dpane/on the remote server
The command would be:
rsync -avz /home/dpane/testData -e "ssh -l dpane" 128.2.244.19:/home/dpane/
You will be prompted for the remote server password (for the user dpane on 128.2.244.19).
Successful Output Example:
dpane@claymore2:~/testData$ rsync -avz /home/dpane/testData -e "ssh -l dpane" 128.2.244.19:/home/dpane/
dpane@128.2.244.19's password:
sending incremental file list
testData/
testData/my-test-data
sent 139 bytes received 39 bytes 4.40 bytes/sec
total size is 0 speedup is 0.00
Common Issues
Permission Denied (Wrong Password)
dpane@128.2.244.19's password:
Permission denied, please try again.
- Make sure you enter the correct remote password.
- Check for typos in the username or IP address.
Tip: Use SSH Keys (Optional)
To avoid entering a password every time, you can set up SSH key authentication between your WSL and the remote server. This is optional but can save time.
Reference
For more detailed documentation, see the page Copying and Syncing Files Guide