{"id":663,"date":"2025-10-21T19:53:58","date_gmt":"2025-10-21T19:53:58","guid":{"rendered":"https:\/\/ni.cmu.edu\/computing\/?post_type=ht_kb&#038;p=663"},"modified":"2025-10-21T19:56:52","modified_gmt":"2025-10-21T19:56:52","slug":"how-to-use-rsync-on-windows-via-wsl","status":"publish","type":"ht_kb","link":"https:\/\/ni.cmu.edu\/computing\/knowledge-base\/how-to-use-rsync-on-windows-via-wsl\/","title":{"rendered":"How to Use rsync on Windows via WSL"},"content":{"rendered":"<p>This guide walks you through setting up and using <code>rsync<\/code> on a Windows system by leveraging WSL (Windows Subsystem for Linux) and a Linux distribution (like Ubuntu). <code>rsync<\/code> is a powerful command-line tool for copying and synchronizing files across systems \u2014 especially useful when working over SSH to a remote server.<\/p>\n<hr \/>\n<h2>Prerequisites<\/h2>\n<ul>\n<li>A Windows 10 or 11 system with <strong>WSL support<\/strong><\/li>\n<li>Administrative privileges (to install WSL)<\/li>\n<li>Internet connection<\/li>\n<li>Basic familiarity with the command line<\/li>\n<\/ul>\n<hr \/>\n<h2>Step 1: Install WSL<\/h2>\n<ol>\n<li>Open <strong>PowerShell as Administrator<\/strong><\/li>\n<li>Run the following command to install WSL (and default Linux distro):\n<pre><code class=\"language-powershell\">wsl --install\r\n<\/code><\/pre>\n<p>This installs the latest version of WSL and a default Linux distribution (usually Ubuntu). You may need to reboot afterward.<\/li>\n<\/ol>\n<blockquote><p>If WSL is already installed, you can check your installed distributions by running:<br \/>\n<code>wsl -l -v<\/code><\/p><\/blockquote>\n<hr \/>\n<h2>Step 2: Install a Linux Distribution (Ubuntu Recommended)<\/h2>\n<p>If WSL didn\u2019t automatically install a distro, or if you want a specific version:<\/p>\n<ol>\n<li>Open the <strong>Microsoft Store<\/strong><\/li>\n<li>Search for <strong>Ubuntu<\/strong><\/li>\n<li>Choose a version (e.g., <strong>Ubuntu 24.04.1 LTS<\/strong>) and click <strong>Install<\/strong><\/li>\n<\/ol>\n<p>After installation:<\/p>\n<ul>\n<li>Launch Ubuntu from the Start menu<\/li>\n<\/ul>\n<hr \/>\n<h2>Step 3: Update Ubuntu and Install <code>rsync<\/code><\/h2>\n<p>Once Ubuntu is open, run the following to fully update the environment and install <code>rsync<\/code>.<\/p>\n<h3>\ud83e\uddf9 Update Ubuntu:<\/h3>\n<pre><code class=\"language-bash\">sudo apt update\r\nsudo apt upgrade\r\nsudo apt dist-upgrade \r\nsudo apt autoremove\r\n<\/code><\/pre>\n<ul>\n<li>You\u2019ll be prompted for your password.<\/li>\n<li>These commands update your package list, install the latest updates, and clean up old packages.<\/li>\n<\/ul>\n<h3>\ud83d\udd27 Install <code>rsync<\/code>:<\/h3>\n<pre><code class=\"language-bash\">sudo apt install rsync\r\n<\/code><\/pre>\n<blockquote><p><code>rsync<\/code> should now be available for use!<\/p><\/blockquote>\n<hr \/>\n<h2>Step 4: Using <code>rsync<\/code> with SSH to Transfer Files<\/h2>\n<p>Here&#8217;s the basic syntax to transfer files from your WSL environment to a remote server:<\/p>\n<pre><code class=\"language-bash\">rsync -avz full_path_to_source -e \"ssh -l username\" server_address:full_path_to_destination\r\n<\/code><\/pre>\n<h3>Parameters Explained:<\/h3>\n<ul>\n<li><code>-a<\/code>: archive mode (preserves permissions, timestamps, etc.)<\/li>\n<li><code>-v<\/code>: verbose output<\/li>\n<li><code>-z<\/code>: compress data during transfer<\/li>\n<li><code>-e<\/code>: specifies the remote shell to use (in this case, <code>ssh<\/code> with a specific login user)<\/li>\n<\/ul>\n<hr \/>\n<h3>Example<\/h3>\n<p>Let\u2019s say:<\/p>\n<ul>\n<li>Your local folder is <code>\/home\/dpane\/testData<\/code><\/li>\n<li>Your remote server is at <code>128.2.244.19 (which is raptor.ni.cmu.edu)<\/code><\/li>\n<li>Your remote username in this example I will use: <code>dpane<\/code><\/li>\n<li>You want to copy to <code>\/home\/dpane\/<\/code> on the remote server<\/li>\n<\/ul>\n<p>The command would be:<\/p>\n<pre><code class=\"language-bash\">rsync -avz \/home\/dpane\/testData -e \"ssh -l dpane\" 128.2.244.19:\/home\/dpane\/\r\n<\/code><\/pre>\n<p>You will be prompted for the <strong>remote server password<\/strong> (for the user <code>dpane<\/code> on <code>128.2.244.19<\/code>).<\/p>\n<hr \/>\n<h3>Successful Output Example:<\/h3>\n<pre><code class=\"language-bash\">dpane@claymore2:~\/testData$ rsync -avz \/home\/dpane\/testData -e \"ssh -l dpane\" 128.2.244.19:\/home\/dpane\/\r\ndpane@128.2.244.19's password:\r\nsending incremental file list\r\ntestData\/\r\ntestData\/my-test-data\r\n\r\nsent 139 bytes  received 39 bytes  4.40 bytes\/sec\r\ntotal size is 0  speedup is 0.00\r\n<\/code><\/pre>\n<hr \/>\n<h2>Common Issues<\/h2>\n<h3>Permission Denied (Wrong Password)<\/h3>\n<pre><code class=\"language-bash\">dpane@128.2.244.19's password:\r\nPermission denied, please try again.\r\n<\/code><\/pre>\n<ul>\n<li>Make sure you enter the correct <strong>remote<\/strong> password.<\/li>\n<li>Check for typos in the username or IP address.<\/li>\n<\/ul>\n<h3>Tip: Use SSH Keys (Optional)<\/h3>\n<p>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.<\/p>\n<hr \/>\n<h2>Reference<\/h2>\n<p>For more detailed documentation, see the page <a href=\"https:\/\/ni.cmu.edu\/computing\/knowledge-base\/copying-and-syncing-files\/\">Copying and Syncing Files Guide<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 \u2014 especially useful when working over SSH to a remote&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[17],"ht-kb-tag":[],"class_list":["post-663","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-unix-help"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb\/663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/comments?post=663"}],"version-history":[{"count":2,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb\/663\/revisions"}],"predecessor-version":[{"id":665,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb\/663\/revisions\/665"}],"wp:attachment":[{"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/media?parent=663"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb-category?post=663"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/ni.cmu.edu\/computing\/wp-json\/wp\/v2\/ht-kb-tag?post=663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}