【已解决】Win7中无法和VirtualBox中的Ubuntu 13.04共享文件夹

作者在使用VirtualBox安装Ubuntu13.04后遇到共享文件夹无法正常工作的困扰,通过多次尝试和解决,最终在非sudo环境下实现了主机Win7与虚拟机Ubuntu13.04之间的文件共享。分享了解决过程和关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

【问题】

之前在VirtualBox:

current virtualbox is 4.3.6 r91406

中安装了Ubuntu 12.10,后来升级到13.04:

unbuntu 13.04 in virtualbox

 

现在想要实现主机Win7中和VirtualBox中的Ubuntu 13.04共享文件夹。

 

【折腾过程】

1.试了试,去VirtualBox窗口中的:

设备->安装增强功能

virtualbox device install enhanced functions

结果期间会显示失败,头文件找不到:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
VirtualBox Guest Additions installer
Removing installed version 4.3.6 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules ... done .
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
  
Building the main Guest Additions module ... done .
Building the shared folder support module ... done .
Building the OpenGL support module ... done .
Doing non-kernel setup of the Guest Additions ... done .
You should restart your guest to make sure the new modules are actually used
  
Installing the Window System drivers
Installing X.Org Server 1.13 modules ... done .
Setting up the Window System to use the Guest Additions ... done .
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.
  
Installing graphics libraries and desktop services components ... done .
Press Return to close this window...

如图:

VirtualBox Guest Additions installer not found header

且最后安装完成后,结果也是无法在/mnt/下面看到想要的hgfs。

但是的确是可以共享剪贴板的。

2.后来是去参考:

【已解决】VMware Workstation的Ubuntu虚拟机中安装VMWare Tools出现提示:Enter the path to the kernel header files for the 3.8.0-27-generic kernel?

去用了:

?
1
sudo ln -s /usr/src/linux-headers- $( uname -r) /include/generated/uapi/linux/version .h /usr/src/linux-headers- $( uname -r) /include/linux/version .h

但是结果还是问题依旧:

重新安装后,还是那个错误:

The headers for the current running kernel were not found.

还是无法共享。

3.参考:

permissions – VirtualBox shared folder is accessible but not workable – Ask Ubuntu

去看看:

试了一堆,结果还是没办法改为自己crifan可以打开的:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
crifan@crifan-Ubuntu:~$ sudo chown -R crifan /media/sf_win7_to_ubuntu/
crifan@crifan-Ubuntu:~$ ls /media/sf_win7_to_ubuntu/ -la
ls : 无法打开目录 /media/sf_win7_to_ubuntu/ : 权限不够
crifan@crifan-Ubuntu:~$ sudo chmod 777 /media/sf_win7_to_ubuntu/
crifan@crifan-Ubuntu:~$ ls /media/sf_win7_to_ubuntu/ -la
ls : 无法打开目录 /media/sf_win7_to_ubuntu/ : 权限不够
crifan@crifan-Ubuntu:~$ sudo ls /media/sf_win7_to_ubuntu/ -la
总用量 4
drwxrwx--- 1 root vboxsf    0 12月 27 09:28 .
drwxr-xr-x 4 root root   4096 12月 27 09:34 ..
crifan@crifan-Ubuntu:~$ sudo chown -R crifan /media/
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/32Bit/Readme.txt" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/32Bit" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/64Bit/Readme.txt" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/64Bit" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/AUTORUN.INF" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/autorun.sh" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/cert/oracle-vbox.cer" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/cert/VBoxCertUtil.exe" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/cert" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/gengradd.dll" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/libc06.dll" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/libc061.dll" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/libc062.dll" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/libc063.dll" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/libc064.dll" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/libc065.dll" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/readme.txt" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/VBoxControl.exe" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/VBoxGuest.sys" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/vboxmouse.sys" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/VBoxReplaceDll.exe" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2/VBoxService.exe" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/OS2" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/runasroot.sh" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/VBoxLinuxAdditions.run" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/VBoxSolarisAdditions.pkg" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/VBoxWindowsAdditions.exe" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/VBoxWindowsAdditions-amd64.exe" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406/VBoxWindowsAdditions-x86.exe" 的所有者: 只读文件系统
chown : 正在更改 "/media/crifan/VBOXADDITIONS_4.3.6_91406" 的所有者: 只读文件系统
crifan@crifan-Ubuntu:~$ 
crifan@crifan-Ubuntu:~$ 
crifan@crifan-Ubuntu:~$ sudo chown -R crifan /media/sf_win7_to_ubuntu/
crifan@crifan-Ubuntu:~$ sudo ls /media/sf_win7_to_ubuntu/ -la
总用量 4
drwxrwx--- 1 root   vboxsf    0 12月 27 09:28 .
drwxr-xr-x 4 crifan root   4096 12月 27 09:34 ..
crifan@crifan-Ubuntu:~$  ls /media/sf_win7_to_ubuntu/ -la
ls : 无法打开目录 /media/sf_win7_to_ubuntu/ : 权限不够
crifan@crifan-Ubuntu:~$ sudo chmod 777 /media/sf_win7_to_ubuntu/
crifan@crifan-Ubuntu:~$ ls /media/sf_win7_to_ubuntu/ -la
ls : 无法打开目录 /media/sf_win7_to_ubuntu/ : 权限不够
crifan@crifan-Ubuntu:~$

4.参考:

virtualbox.org • View topic – shared folders not seen

再去手动试试mount结果出错:

?
1
2
3
4
5
crifan@crifan-Ubuntu:~$ sudo mkdir /mnt/share
crifan@crifan-Ubuntu:~$ 
crifan@crifan-Ubuntu:~$ sudo mount -t vboxsf -o rw,uid=1000,gid=1000 share /mnt/share
/sbin/mount .vboxsf: mounting failed with the error: Protocol error
crifan@crifan-Ubuntu:~$

5.结果后来发现:

其实都已经可以正常工作了:

ubuntu share with win7 already ok

只是自己没去试试罢了。。。

 

【总结】

但是在Ubuntu中非sudo不能直接操作,感觉还是有点诡异的。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值