VirtualBox内Linux系统怎样与Windows共享文件夹

2025-04-27 22:06:40
推荐回答(1个)
回答1:

Linux 安装samba
Centos用 :
yum install samba-client samba-common cifs-utils

Ubuntu用:
apt-get install -y samba samba-common python-glade2 system-config-samba
修改smb配置文件
cp -pf /etc/samba/smb.conf /etc/samba/smb.conf.bak
cat /dev/null > /etc/samba/smb.conf
gedit /etc/samba/smb.conf
例如改为
#------------------smb.conf start-------------------------------

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = ubuntu
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ==============================

[Anonymous]
path = /samba/anonymous
browsable =yes
writable = yes
guest ok = yes
read only = no
force user = nobody
#--------------------smb.conf end------------------------------
重启samba。
service smbd restart
在终端把Windows共享文件挂载到/mnt/cifs下:

mkdir /mnt/cifs
mount -t cifs //192.168.xxx.xxx/device /mnt/cifs -o username=share,password=share,rw,file_mode=0777,dir_mode=0777,setuid=509,setgid=101

其中,uid=509, gid=101是一个普通用户user1
/mnt/cifs权限位是0777,所有用户有完全访问权限。

是不是看傻了,傻眼就回家找妈妈。