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