1. 安装增强功能包(Guest Additions)
运行ubuntu并登录,点击设备/安装增强功能。
![Vbox下Ubuntu1404设置共享文件夹 Vbox下Ubuntu1404设置共享文件夹](https://i-blog.csdnimg.cn/blog_migrate/32ec5e02d8da2139aa9b3d64cc92c3b2.jpeg)
安装成功后,在桌面上显示一个光盘图标,双击该图标,将提示安装。
![Vbox下Ubuntu1404设置共享文件夹 Vbox下Ubuntu1404设置共享文件夹](https://i-blog.csdnimg.cn/blog_migrate/bc791f6a55bffa0ffff1272487755f4d.jpeg)
![Vbox下Ubuntu1404设置共享文件夹 Vbox下Ubuntu1404设置共享文件夹](https://i-blog.csdnimg.cn/blog_migrate/d6693f8017769535afc98a03c66c9f76.jpeg)
授权后即可进行安装。
也可以在命令行下安装。安装文件在“/media/用户名/ “,找到.run文件运行。
![Vbox下Ubuntu1404设置共享文件夹 Vbox下Ubuntu1404设置共享文件夹](https://i-blog.csdnimg.cn/blog_migrate/0e60820e1f4c5d25842539ff6bf761fa.jpeg)
点击设备/共享文件夹,选【固定分配】,点击右侧的添加图标,创建Windows共享文件夹的位置。文件夹的名称最好为英文。如share。
如果未设置共享文件夹,先进行第3步,则会提示“mounting failed with the error:Protocol error”。
3. 挂载共享文件夹
a. 手动挂载到自定义的目录。进入命令行,执行以下命令:
sudo mkdir /mnt/share
sudo mount –t vboxsf share /mnt/share
如果在“~/.profile”或者/etc/profile文件中,添加“mount –t vboxsf share /mnt/share”,上电时可挂载。
b. Vbox 有一个自动挂载功能,如下图所示![Vbox下Ubuntu1404设置共享文件夹 Vbox下Ubuntu1404设置共享文件夹](https://i-blog.csdnimg.cn/blog_migrate/87bf06661df0cfc75cbc89bfb03983e7.jpeg)
勾选了该项,自动在/media目录下挂载,如下图所示的sf_share。
![Vbox下Ubuntu1404设置共享文件夹 Vbox下Ubuntu1404设置共享文件夹](https://i-blog.csdnimg.cn/blog_migrate/12fdfae3381a8a799bc9c4d541a6bf02.jpeg)
网上查的自动挂载方式:如在自动挂载分区文件/etc/fstab下追加“share /mnt/share vboxsf rw,gid=100,uid=1000,auto 0 0”或者追加“share /mnt/share vboxsf defaults 0 0”或者在/etc/rc.local文件里追加“mount -t vboxsf sharing /mnt/share ”。均是无效的。前面两种还会导致系统无法启动。
4. 文件传送
Windows和Ubuntu虚拟电脑间的文件传动可通过创建的共享文件夹传送。即在Windows下的share目录下可见到Ubuntu系统/mnt/shared目录下所有的内容。
5. 卸载共享文件夹
在命令行输入如下指令,即可卸载共享:
sudo umount /mnt/share
参考文章:
http://www.doc88.com/p-718479082182.html