To be able to access files on a host machine from a Multipass Ubuntu VM, we can mount the local directory into the virtual machine.
Assuming we have a host system directory my-stuff, we can mount it into the VM with:
$ multipass mount my-stuff primary:/home/ubuntu/my-stuff
Note the required name primary which refers to the VM instance name.
Check that the mount shows up correctly in Multipass:
$ multipass info primary
This should show your local and VM directory, with a line similar to:
Mounts: /Users/abc/Documents/my-stuff => /home/ubuntu/my-stuff
SSH into the VM to see the directory:
$ multipass shell
ubuntu@primary:~$ ls my-stuff file1 file2 ...
The directory should now be accessible inside the VM and we can share files between the host machine and VM.
Related Posts