VBoxManage sharedfolder add <uuid|vmname> --name <name> --hostpath <hostpath> [--transient] [--readonly] [--automount]
This command allows you to share folders on the host computer with guest operating systems. For this, the guest systems must have a version of the VirtualBox Guest Additions installed which supports this functionality.
Parameters are:
-
<uuid|vmname>
Specifies the UUID or name of the VM whose guest operating system will be sharing folders with the host computer. Mandatory. -
--name <name>
Specifies the name of the share. Each share has a unique name within the namespace of the host operating system. Mandatory. -
-hostpath <hostpath>
Specifies the absolute path on the host operating system of the folder/directory to be shared with the guest operating system. Mandatory. -
-transient
Specifies that the share is 'transient', meaning that it can be added and removed at runtime and does not persist after the VM has stopped. Optional. -
-readonly
Specifies that the share has only read-only access to files at the host path.By default, shared folders have read/write access to the files at the host path. More specifically, on Linux distros - shared folders are mounted with 770 io permissions with root user and vboxsf as the group, and using this option the io permissions change to 700. Optional.
-
-automount
Specifies that the share will be automatically mounted. On Linux distros, this will be to either /media/USER/sf_<name> or /media/sf_<name> - depending on your guest OS. Where <name> is the share name. Optional.
VBoxManage sharedfolder remove <uuid|vmname> --name <name> [--transient]
This command allows you to delete shared folders on the host computer shares with the guest operating systems. For this, the guest systems must have a version of the VirtualBox Guest Additions installed which supports this functionality.
Parameters are:
-
<uuid|vmname>
Specifies the UUID or name of the VM whose guest operating system is sharing folders with the host computer. Mandatory. -
--name <name>
Specifies the name of the share to be removed. Each share has a unique name within the namespace of the host operating system. Mandatory. -
-transient
Specifies that the share is 'transient', meaning that it can be added and removed at runtime and does not persist after the VM has stopped. Optional.
Shared folders are described in detail in Section 4.3, “Shared folders”.