分成4种情况,win->win映射、linux->linux映射、linux->win、win->linux。
这里只介绍后面两种情况。

linux映射到windows

  1. 虚拟机可以安装vmware-tools,开启文件夹共享
  2. 安装samba,按照以下步骤
# install depend softwares
# install samba
apt install samba
# modify profile
# uncomment all configure of `homes` labels
vim /etc/samba/smb.conf
# add users
smbpasswd -a root
# restart samba
service samba restart

\"在这里插入图片描述\"在这里按照提示输入地址,账号密码。如果不行就关闭防火墙,selinux service ufw stop && setenforce 0

windows映射到linux

  1. 同上!虚拟机共享
  2. 按照下面步骤
# on windows, enable sharing and build a share directory
# install samba client
apt install samba-client cifs-utils

新建脚本文件mount_windows.sh添加以下内容。
mount.cifs //windows_ip_address/directory_of_share /root -o username=windows_user,password=windows_password
运行这个文件就挂在在root目录下了。

收藏 打印