Rsync is a powerful tool for file synchronization, and when paired with SSH, it enables secure file transfers between systems. This step-by-step guide will walk you through setting up Rsync and SSH on your Windows computer and Linux server for seamless file transfers.
Setting up SSH on both Windows and Linux systems #
- Windows 10 version 1809 and later includes a built-in OpenSSH client. To enable it, open PowerShell or Command Prompt and enter the following command:
Get-WindowsCapability -Online | Where-Object {$_.Name -like 'OpenSSH.Client*'} | Add-WindowsCapability -Online
- The above command installs OpenSSH client on your windows system

- Once the installation is cone, you can test ssh connections using this command syntax below. Replace remote_user and remote_linux_server with real details or your linux server
ssh user@remote_linux_server

- 0n the Linux server, SSH will already be be pre-configured to work, thus no further action is needed by you.
Installing and configuring Rsync on Windows and Linux #
- Rsync is usually pre-installed on Linux. However, you can install it using these commands below, depending on your Linux Distro
Ubuntu/Debian
sudo apt-get update
sudo apt-get install rsync
Almalinux/CentOS/RHEL
sudo yum install rsync
- You also need to ensure that SSH is configured to allow Rsync connections on Linux.
- To do that, open this file /etc/ssh/sshd_config using an editor of your choice, like vi, then look for the line that says
Subsystem sftp /usr/lib/openssh/sftp-server
and uncomment it (remove the “ at the beginning of the line).
vi /etc/ssh/sshd_config
- Save the file, then restart SSH service using the command below;
sudo systemctl restart ssh
Set up Rsync On Windows
On Windows, you can install the Cygwin tool, which includes Rsync. Go to the Cygwin website to download the installer.

During installation, select the “Rsync” package from the available options.

Transferring files from Windows to Linux using Rsync and SSH #
- You now have Rsync set up both on your Windows and Linux servers. Now open the Cygwin terminal on your windows machine. You can use the search box at the botton left to search for them.

- From the terminal, you can navigate to the location of the file that you want to move
Important note
When you use rsync in Cygwin, you need to check Windows directories from the /cygdrive mount point. For example, if your folder to sync is located in the Downloads directory on your windows machine, the path would be something like /cygdrive/c/Users/your_username/Downloads/<your folder>.
- For example to move to Local Disk C, I will type this below. Note that /cygdrive/ is then added just before C on the terminal
C:

- To move to a directory in disk C, /Users/rootadmin, I will do as follows;
cd /cygdrive/c/Users/rootadmin

- You will then use the command below to copy your files from the windows server to the linux server
rsync -avzc --delete -e "ssh" /path/to/local/files user@remote_linux_server:/path/to/remote/destination

- In the above Rsync command syntax, below is what each of the sections mean;
rsync
: Starts the Rsync utility.-avzc
: Activates these options:-a
: Preserves file attributes and permissions.-v
: Enables verbose mode for detailed output.-z
: Compresses data to reduce transfer size.-c
: Verifies file checksums for data integrity.
--delete
: Removes files from the remote server that aren’t in the local directory.-e "ssh"
: Uses SSH for secure transfer./path/to/local/files
: Placeholder for path to the files or directory on your local machine.user@remote_linux_server:/path/to/remote/destination
: Placeholder for SSH username and path to the destination on the remote Linux server.
- You will need to replace the place holders with your real values
When you run this command for the first time, you’ll be prompted to confirm the remote server’s host key. After you accept the host key, the file transfer will start, and progress details will appear in the console.
In case of any issues, please check with the Truehost Support team