It's a bit odd:
Accessing WSL files from Windows is easy and built-in to WSL -- Just use the \\wsl$\<distro> drive share.
Accessing Windows files from WSL is also easy -- Just use the /mnt/<drive_letter> mount points.
Accessing files in one WSL instance from another isn't "built in", but can be accomplished through the use of bind mounts in each distro to the shared /mnt/wsl tmpfs mount.
Just execute the following command in both Ubuntu and Kali:
echo "/ /mnt/wsl/instances/$WSL_DISTRO_NAME none defaults,bind,X-mount.mkdir 0 0" | sudo tee -a /etc/fstab
Then exit each, issue a wsl --shutdown from PowerShell or CMD (a --terminate of each would suffice as well), and restart.
You'll find the files for each now in their respective /mnt/wsl/instances/<distroname> bind mount. 1
This works by creating an /etc/fstab entry that creates a bind mount using the distribution name in /mnt/wsl/instances/$WSL_DISTRO_NAME when the instance is started. the X-mount.mkdir allows mount to create the parent directories needed if they don't exist, similar to mkdir -p.
The /mnt/wsl directory is a tmpfs that is automatically:
- Created by WSL when it first starts
- Available to all WSL2 distributions
Additional notes:
1 If /mnt/wsl/instances is empty or missing after doing this, you may be running a recent WSL release with a change in the mount order. Please see Option 1.5 in this Super User answer for a workaround.
Note that this does not work for WSL1 distributions
Also note that this method requires both distributions to be running. For some methods that don't require the second distro to be running, see my older methods in this Super User answer. Options 2 and 3 will both work even if the second distro isn't running.