1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!DOCTYPE topic
|
---|
3 | PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
|
---|
4 | <topic xml:lang="en-us" id="sharedfolders">
|
---|
5 | <title>Shared Folders</title>
|
---|
6 |
|
---|
7 | <body>
|
---|
8 | <p>With the <i>shared folders</i> feature of <ph conkeyref="vbox-conkeyref-phrases/product-name"/>, you can access files of your host system from within the guest system. This is similar to how you would use network shares in Windows networks, except that shared folders do not require networking, only the Guest Additions. Shared folders can be used with Windows 2000 or later, Linux, and Oracle Solaris guests. Shared Folders can't be used on Arm VMs running Windows.</p>
|
---|
9 | <p>Shared folders physically reside on the <i>host</i> and are then shared with the guest, which uses a
|
---|
10 | special file system driver in the Guest Additions to talk to the host. For Windows guests, shared folders are
|
---|
11 | implemented as a pseudo-network redirector. For Linux and Oracle Solaris guests, the Guest Additions provide a
|
---|
12 | virtual file system. </p>
|
---|
13 | <p>To share a host folder with a virtual machine in <ph conkeyref="vbox-conkeyref-phrases/product-name"
|
---|
14 | />, you must specify the path of the folder and choose a <i>share name</i> that the guest can use to access the
|
---|
15 | shared folder. This happens on the host. In the guest you can then use the share name to connect to it and access
|
---|
16 | files. </p>
|
---|
17 | <p>There are several ways in which shared folders can be set up for a virtual machine: </p>
|
---|
18 | <ul>
|
---|
19 | <li>
|
---|
20 | <p>In the window of a running VM, you select <b outputclass="bold">Shared Folders</b> from the <b
|
---|
21 | outputclass="bold">Devices</b> menu, or click the folder icon on the status bar in the bottom right corner. </p>
|
---|
22 | </li>
|
---|
23 | <li>
|
---|
24 | <p>If a VM is not currently running, you can configure shared folders in the virtual machine's <b
|
---|
25 | outputclass="bold">Settings</b> window. </p>
|
---|
26 | </li>
|
---|
27 | <li>
|
---|
28 | <p>From the command line, you can create shared folders using <userinput>VBoxManage</userinput>, as
|
---|
29 | follows: </p>
|
---|
30 | <pre xml:space="preserve">VBoxManage sharedfolder add "VM name" --name "sharename" --hostpath "C:\test"</pre>
|
---|
31 | <p> See <xref href="../cli_topics/vboxmanage-sharedfolder.dita"/>.</p>
|
---|
32 | </li>
|
---|
33 | </ul>
|
---|
34 | <p>There are two types of shares: </p>
|
---|
35 | <ul>
|
---|
36 | <li>
|
---|
37 | <p>Permanent shares, that are saved with the VM settings. </p>
|
---|
38 | </li>
|
---|
39 | <li>
|
---|
40 | <p>Transient shares, that are added at runtime and disappear when the VM is powered off. These can
|
---|
41 | be created using a check box in <ph conkeyref="vbox-conkeyref-phrases/vbox-mgr"/>, or by using the
|
---|
42 | <codeph>--transient</codeph> option of the <userinput>VBoxManage sharedfolder add</userinput> command. </p>
|
---|
43 | </li>
|
---|
44 | </ul>
|
---|
45 | <p>Shared folders can either be read-write or read-only. This means that the guest is either allowed to
|
---|
46 | both read and write, or just read files on the host. By default, shared folders are read-write. Read-only folders
|
---|
47 | can be created using a check box in the <ph conkeyref="vbox-conkeyref-phrases/vbox-mgr"/>, or with the
|
---|
48 | <codeph>--readonly option</codeph> of the <userinput>VBoxManage sharedfolder add</userinput> command. </p>
|
---|
49 | <p><ph conkeyref="vbox-conkeyref-phrases/product-name"/> shared folders also support symbolic links, also
|
---|
50 | called <i>symlinks</i>, under the following conditions: </p>
|
---|
51 | <ul>
|
---|
52 | <li>
|
---|
53 | <p>The host operating system must support symlinks. For example, a macOS, Linux, or Oracle Solaris
|
---|
54 | host is required. </p>
|
---|
55 | </li>
|
---|
56 | <li>
|
---|
57 | <p>The guest VM must have a version of the Guest Additions installed which supports symlinks.
|
---|
58 | Currently only the Linux and Oracle Solaris Guest Additions support symlinks. </p>
|
---|
59 | </li>
|
---|
60 | <li>
|
---|
61 | <p>For security reasons the guest OS is not allowed to create symlinks by default. If you trust the
|
---|
62 | guest OS to not abuse this functionality, you can enable the creation of symlinks for a shared folder as
|
---|
63 | follows: </p>
|
---|
64 | <pre xml:space="preserve">VBoxManage setextradata <varname>VM-name</varname> VBoxInternal2/SharedFoldersEnableSymlinksCreate/<varname>sharename</varname> 1</pre>
|
---|
65 | </li>
|
---|
66 | </ul>
|
---|
67 | <p>If a symbolic link is created inside a shared folder on the host and the installed Guest Additions do not
|
---|
68 | support symbolic links then the guest will see the target of the symlink as a file inside the shared folder. For
|
---|
69 | example, if a symlink is created to a file on a Linux host: </p>
|
---|
70 | <p>
|
---|
71 | <pre xml:space="preserve">$ cd /SharedFolder && ln -s filename symlink-to-filename</pre>
|
---|
72 | </p>
|
---|
73 | <p>When the shared folder is viewed on a Windows guest there will be two identical files listed,
|
---|
74 | <userinput>filename</userinput> and <userinput>symlink-to-filename</userinput>. </p>
|
---|
75 | </body>
|
---|
76 |
|
---|
77 |
|
---|
78 | </topic>
|
---|