解决WIN7与虚拟机CentOS的文件夹共享问题
一、系统与软件
WIN7 64bit、VirtualBox 5.0.14、CentOS 6.5、SecureCRT 7.2.3
二、使用文件夹共享需要安装增强功能,但是安装时无法读取光盘iso文件



三、为了方便操作,配置静态IP,并使用CRT连接上去(参考http://my.oschina.net/allman90/blog/294847?fromerr=CotpElUe)
[root@pc ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 //指出设备名称
HWADDR=:::::4A //硬件Mac地址
TYPE=Ethernet //网络类型
UUID=c1d0e14c-cd39--af44-37daca90c1f9 //设备UUID编号
ONBOOT=yes //是否启动应用
NM_CONTROLLED=yes //设备是否被NetworkManager管理
BOOTPROT=static //启动类型 dhcp|static
BROADCAST=192.168.88.203 //广播地址
IPADDR=192.168.88.111 //IP地址
NETMASK=255.255.255.0 //子网掩码
NETWORK=192.168.88.0 //网络地址
GATEWAY=192.168.88.254 //网关地址
DNS1=8.8.8.8 //DNS
[root@pc ~]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
[root@pc ~]# ifconfig
eth0 Link encap:Ethernet HWaddr :::::2C
inet addr:192.168.88.111 Bcast:192.168.88.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe57:732c/ Scope:Link
UP BROADCAST RUNNING MULTICAST MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (11.9 MiB) TX bytes: (341.4 KiB) lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::/ Scope:Host
UP LOOPBACK RUNNING MTU: Metric:
RX packets: errors: dropped: overruns: frame:
TX packets: errors: dropped: overruns: carrier:
collisions: txqueuelen:
RX bytes: (0.0 b) TX bytes: (0.0 b)
[root@pc ~]# ping www.baidu.com
PING www.baidu.com (111.13.100.92) () bytes of data.
bytes from 111.13.100.92: icmp_seq= ttl= time=59.1 ms
bytes from 111.13.100.92: icmp_seq= ttl= time=65.4 ms

四、既然无法读取光盘,便采用FTP上传,配置FTP(参考http://os.51cto.com/art/201408/448630.htm)
[root@pc ~]# yum -y install vsftpd // 安装FTP
...
Complete!
[root@pc ~]# service vsftpd start // 启动FTP
Starting vsftpd for vsftpd: [ OK ]
[root@pc ~]# vi /etc/sysconfig/iptables // 防火墙开启21端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport -j ACCEPT
[root@pc ~]# service iptables restart // 重启防火墙
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
[root@pc ~]# cat /etc/passwd | grep ftp // 新增一个账户ftpuser,并设置密码
ftp:x:::FTP User:/var/ftp:/sbin/nologin
[root@pc ftp]# useradd -g ftp ftpuser
[root@pc ftp]# passwd ftpuser
Changing password for user ftpuser.
无法读取目录 
[root@pc ~]# getsebool -a | grep ftp // 开启外网访问
allow_ftpd_full_access --> off
ftp_home_dir --> off
[root@pc ~]# setsebool -P allow_ftpd_full_access
[root@pc ~]# setsebool -P ftp_home_dir
[root@pc ~]# vi /etc/vsftpd/vsftpd.conf // 设定passive模式端口范围
pasv_min_port=
pasv_max_port=
[root@pc ~]# service vsftpd restart // 重启FTP
[root@pc ~]# vi /etc/sysconfig/iptables // 开启防火墙对应范围端口
-A INPUT -m state --state NEW -m tcp -p tcp --dport : -j ACCEPT
[root@pc ~]# service iptables restart // 重启防火墙
正常连接上虚拟机 
把VirtualBox安装目录下的 VBoxGuestAdditions.iso 解压,并通过FTP客户端filezilla上传到虚拟机
[root@pc ~]# cd /home/ftpuser/
[root@pc ftpuser]# ll
total
drwxr-xr-x. ftpuser ftp Apr : VBoxGuestAdditions
五、开始安装增强功能
[root@pc ~]# cd /home/ftpuser/VBoxGuestAdditions/
[root@pc VBoxGuestAdditions]# ll
total
drwxr-xr-x. ftpuser ftp Apr : 32Bit
drwxr-xr-x. ftpuser ftp Apr : 64Bit
-rw-r--r--. ftpuser ftp Apr : AUTORUN.INF
-rw-r--r--. ftpuser ftp Apr : autorun.sh
drwxr-xr-x. ftpuser ftp Apr : cert
drwxr-xr-x. ftpuser ftp Apr : OS2
-rw-r--r--. ftpuser ftp Apr : runasroot.sh
-rw-r--r--. ftpuser ftp Apr : VBoxLinuxAdditions.run
-rw-r--r--. ftpuser ftp Apr : VBoxSolarisAdditions.pkg
-rw-r--r--. ftpuser ftp Apr : VBoxWindowsAdditions-amd64.exe
-rw-r--r--. ftpuser ftp Apr : VBoxWindowsAdditions.exe
-rw-r--r--. ftpuser ftp Apr : VBoxWindowsAdditions-x86.exe
[root@pc VBoxGuestAdditions]# chmod +x runasroot.sh
[root@pc VBoxGuestAdditions]# ./runasroot.sh
Usage: runasroot.sh DESCRIPTION COMMAND [ADVICE] Attempt to execute COMMAND with root privileges, displaying DESCRIPTION if
possible and displaying ADVICE if possible if no su()-like tool is available.
[root@pc VBoxGuestAdditions]# chmod +x VBoxLinuxAdditions.run
[root@pc VBoxGuestAdditions]# ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0. Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules [ OK ]
Building the VirtualBox Guest Additions kernel modules
The gcc utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it. The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
yum install kernel-devel-2.6.-.el6.x86_64 Building the main Guest Additions module [FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions [ OK ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
[root@pc VBoxGuestAdditions]# cat /var/log/vboxadd-install.log
/tmp/vbox./Makefile.include.header:: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.
Creating user for the Guest Additions.
Creating udev rule for the Guest Additions kernel module.
查找报错 Building the main Guest Additions module [FAILED](参考 http://www.xuebuyuan.com/2039380.html)
[root@pc VBoxGuestAdditions]# yum -y install gcc make gcc-c++
[root@pc VBoxGuestAdditions]# yum -y install kernel
[root@pc VBoxGuestAdditions]# yum -y install kernel-devel
[root@pc VBoxGuestAdditions]# yum -y install kernel-headers
重启CentOS并再次执行VBoxLinuxAdditions.run,依旧报错(参考 http://askubuntu.com/questions/22743/how-do-i-install-guest-additions-in-a-virtualbox-vm)
[root@pc VBoxGuestAdditions]# yum update
[root@pc ~]# /opt/VBoxGuestAdditions-5.0./uninstall.sh
[root@pc ~]# /home/ftpuser/VBoxGuestAdditions/VBoxLinuxAdditions.run
[root@pc ~]# cat /var/log/vboxadd-install.log
/bin/sh: perl: command not found
这次变成报没有 perl,于是 yum -y install perl 补齐
再次进行安装
[root@pc ~]# /opt/VBoxGuestAdditions-5.0./uninstall.sh
[root@pc ~]# /home/ftpuser/VBoxGuestAdditions/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0. Guest Additions for Linux............
VirtualBox Guest Additions installer
You appear to have a version of the VBoxGuestAdditions software
on your system which was installed from a different source or using a
different type of installer. If you installed it from a package from your
Linux distribution or if it is a default part of the system then we strongly
recommend that you cancel this installation and remove it properly before
installing this version. If this is simply an older or a damaged
installation you may safely proceed. Do you wish to continue anyway? [yes or no]
yes
Removing existing VirtualBox non-DKMS kernel modules [ OK ]
grep: /opt/VBoxGuestAdditions-*/init/*: No such file or directory
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules [ OK ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module [ OK ]
Building the shared folder support module [ OK ]
Building the OpenGL support module [FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong. The module is not built but the others are.)
Doing non-kernel setup of the Guest Additions [ OK ]
Starting the VirtualBox Guest Additions [ OK ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
终于成功了,其中 OpenGL 失败是因为我的CentOS是精简版没有界面的!
六、设置共享

[root@pc ~]# ll /media/
total
drwxrwx---. root vboxsf Mar : sf_win_www
----------------------------------2019-01-10----------------------------------
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
% /
tmpfs % /dev/shm
/dev/sda1 % /boot
.host://www 165686344 81123004 84563340 49% /datas/htdocs
.host://log 165686344 81123004 84563340 49% /datas/log
.host://vmware 157300384 89902340 67398044 58% /datas/vmware
[root@localhost ~]# vmware-hgfsclient #查看共享目录
www
vmware
log
python
[root@localhost ~]# mount -t vmhgfs .host:/python /datas/python #挂载
Error: cannot canonicalize mount point: No such file or directory
[root@localhost ~]# mkdir /datas/python
[root@localhost ~]# mount -t vmhgfs .host:/python /datas/python
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
% /
tmpfs % /dev/shm
/dev/sda1 % /boot
.host:/www 165686344 81123004 84563340 49% /datas/htdocs
.host:/log 165686344 81123004 84563340 49% /datas/log
.host:/vmware 157300384 89902340 67398044 58% /datas/vmware
.host:/python 165686344 81123004 84563340 49% /datas/python
[root@localhost ~]# ll /datas/python/
total
-rwxrwxrwx root root May .log
[root@localhost ~]# vim /etc/fstab #自动挂载
.host:/python /datas/python vmhgfs iocharset=utf8,rw,uid=www,gid=www 0 1
[root@localhost ~]# init
[root@localhost ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGroup-lv_root
% /
tmpfs % /dev/shm
/dev/sda1 % /boot
.host:/www 165686344 81123004 84563340 49% /datas/htdocs
.host:/log 165686344 81123004 84563340 49% /datas/log
.host:/vmware 157300384 89902340 67398044 58% /datas/vmware
.host:/python 165686344 81123004 84563340 49% /datas/python
https://blog.csdn.net/qq_30309813/article/details/79830356
https://www.cnblogs.com/qiyebao/p/4484047.html
解决WIN7与虚拟机CentOS的文件夹共享问题的更多相关文章
- centos 下文件夹共享
[root@localhost share]# yum install samba -y[root@localhost share]# cp /etc/samba/smb.conf /etc/samb ...
- 解决win7无法打开chm格式文件的问题
解决win7无法打开chm格式文件的问题. (一).简单方法(本人用的这个) 1.打开chm2.win7提示安全问题3.chm无法显示内容4.关闭chm5.右键点击chm,点击“解除锁定”,ok 没 ...
- [转]Virtualbox主机和虚拟机之间文件夹共享及双向拷贝(Windows<->Windows, Windows<->Linux)
本文转自:https://www.jb51.net/article/97271.htm 最近学习Virtualbox的一些知识,记录下,Virtualbox下如何实现主机和虚拟机之间文件夹共享及双向拷 ...
- VMWare12虚拟机实现主客机间的文件拖拽(复制粘贴)和文件夹共享
版本: 主机:Windows 7 64位旗舰版 虚拟机: VMWare 12 + Windows 7 64位旗舰版 VMWare pro 12 + Ubuntu16.04LTS 64位 注:由于VMW ...
- 2017-7-19-每日博客-关于Linux下的CentOS中文件夹基本操作命令.doc
CentOS中文件夹基本操作命令 文件(夹)查看类命令 ls--显示指定目录下内容 说明:ls 显示结果以不同的颜色来区分文件类别.蓝色代表目录,灰色代表普通文件,绿色代表可执行文件,红色代表压缩文件 ...
- win7文件夹共享(不新建账户、不带密码直接访问)
1.右键需要共享的文件夹>共享>特定用户>选择Everyone>“添加”>“共享” 2.打开控制面板>按类别的查看方式>网络和Internet下的选择家庭组和 ...
- 负载均衡下的资源文件配置/多站点下的资源文件夹共享(Windows IIS)
前言: 负载均衡用的是NLB,微软的方案不太靠谱,举个例子吧,AB两台服务器负载出C,如果用户访问访问C之后分配的是A,那么如果A挂了,是不会自动切换到B的.据说后来还有一种NLB的方案可以实现,也不 ...
- 工程师技术(四):配置SMB文件夹共享、多用户Samba挂载、普通NFS共享的实现、安全NFS共享的实现
一.配置SMB文件夹共享 目标: 本例要求在虚拟机 server0 上发布两个共享文件夹,具体要求如下: 1> 此服务器必须是 STAFF 工作组的一个成员 2> 发布目录 /comm ...
- Powershell学习之道-文件夹共享及磁盘映射
导读 在Linux环境下,我们很轻易就能得心应手地通过命令操作一切事物,在Windows下,Powershell也算是后起之秀,提供大量的cmdlet以及c#的横向拓展.下面将由小编带领大家通过Pow ...
随机推荐
- 《Entity Framework 6 Recipes》中文翻译系列 (41) ------ 第七章 使用对象服务之标识关系中使用依赖实体与异步查询保存
翻译的初衷以及为什么选择<Entity Framework 6 Recipes>来学习,请看本系列开篇 7-7 标识关系中使用依赖实体 问题 你想在标识关系中插入,更新和删除一个依赖实体 ...
- 2013 duilib入门简明教程 -- 复杂控件介绍 (13)
首先将本节要介绍的控件全部拖到界面上,并调整好位置,如图: 然后将Name属性改成其他名字, 不能是[控件名+UI+数字]这种,因为这是DuiDesigner ...
- iOS开发--应用崩溃日志揭秘(二)
场景 4: 吃棒棒糖时闪退! 用户邮件说, “当rage master吃棒棒糖时应用就闪退…” 另一用户说, “我让rage master 吃棒棒糖,没几次应用就闪退了!”崩溃日志如下: Incide ...
- jdk1.7.0_80源码包结构
解压源码src.zip,jdk源码结构如下所示: src |--com.sun sun公司对jdk的实现,Oracle官方不支持,不保证跨平台(可能一些类linux有而windows没有),甚至 ...
- SSISDB6:Operation
SSISDB使用Operation表示对SSIS Project所做的任何操作,在执行一次Operation时,SSISDB会记录Operation的Message,当触发Event时,会记录Even ...
- Unity 特殊文件夹 : 位置不能随便放
有以下几个文件夹: Assets 用来存放资源的文件夹,包括各种材质.模型等 Editor 编辑器类等脚本 Editor Default Resources Editor scripts can ma ...
- JavaScript JsTree实例
var RightTree= function () { }; RightTree.prototype = { //初始化权限树 InitRightTree: function () { $.ajax ...
- javascript运动系列第四篇——抖动
× 目录 [1]原理介绍 [2]代码实现 [3]实例应用 前面的话 在运动系列中,前面分别介绍了匀速运动.变速运动和曲线运动.下面介绍一种特殊的运动形式——抖动 原理介绍 抖动其实是往复运动的一种特殊 ...
- 基于Fragment的百度地图框架的使用
博客:http://blog.csdn.net/developer_jiangqq (一)基本介绍(Fragment和SupportMapFragment): Fragment的使用现在安卓APP开发 ...
- 【原创】开源Math.NET基础数学类库使用(03)C#解析Matlab的mat格式
本博客所有文章分类的总目录:[总目录]本博客博文总目录-实时更新 开源Math.NET基础数学类库使用总目录:[目录]开源Math.NET基础数学类库使用总目录 前言 ...