0

I installed Ubuntu 22.04 in WSL2 and I want to transfer files from Ubuntu 20.04 that is installed in a same Windows.

At first I send files via mounted Windows files sysmtem.

Rsync in Ubuntu 20.04:

rsync ~/foo /mnt/c/tmp

Rsync in Ubuntu 22.04:

rsync /mnt/c/tmp ~/foo

But with this way permissions are collapsed.

Is there are recommended way to transfer files between two WSL systems?

Giacomo1968
  • 55,001
ironsand
  • 2,299
  • Have you tried the -avz parameters with Rsync? That is standard for many Rsync commands. The key is the -a parameter which is the --archive mode that preserves ownership and permissions. The -v is verbose mode and -z compresses files during the transfer. You could try it with just -a like this rsync -a ~/foo /mnt/c/tmp or even rsync -a /mnt/c/tmp ~/foo. Let me know if this works for you and I can post it as an answer. – Giacomo1968 Oct 17 '22 at 02:03
  • 2
    Does this answer your question? Is there a way to access files from one WSL 2 distro/image in another one? -- Let me know if that helps. All of those options I mention in my answer there should keep permissions. But transferring files to the /mnt/c (which doesn't quite match up with your title) will have permission issues unless you add the metadata mount option as in this answer. – NotTheDr01ds Oct 17 '22 at 02:17

0 Answers0