Set up a shared folder under Windows system
-
Create a shared folder testShare.
Set related operations:
(1) Right-click, click Properties
(2) Select Sharing
(3) Click Add, select Everyone, set permissions to read/write, click Share, and complete -
Open the network, enter \127.0.0.1, press Enter, and you will find the folder testShare you just shared.
Loading under Linux system
- Install packages
# Debain
apt-get install -y cifs-utils
# Redhat/CentOS
yum install -y cifs-utils.x86_64
(1) Offline installation (utubun 14.04)
a. Download the software package
Detailed tutorial:
https://blog.csdn.net/weixin_38090079/article/details/131846961?spm=1001.2014.3001.5502
apt-get install -y -d cifs-utils
# 切换到下载的依赖包目录
cd /var/cache/apt/archives
b. Install dependent packages
#依赖包目录执行
dpkg -i *.deb
- Create the mounted directory
# Windows有账号密码
mount -t cifs -o username=Administrator,password=123456 //192.168.31.33/share /mnt/share
# Windows无账号密码
mount -t cifs //192.168.31.33/share /mnt/share
//192.168.31.33: windows shared address
/share: windows shared directory
/mnt/share: linux mount directory
- Unmount
using the umount command.
umount /mnt/share
Then you can find that the test mount is lifted.
4. Automatically mount at boot (modify /etc/fstab file)
# 将//192.168.3.4/sharedir挂载到/mnt/cifs上,并指定了用户名和密码
//192.168.3.4/sharedir /mnt/cifs cifs username=demo,password=demo 0 0
Summary of three common mistakes
mount.cifs: bad UNC
Problem description: During the mount process, the following error is returned:
mount.cifs: bad UNC
Cause analysis: The syntax of UNC is incorrect, that is, the address format is incorrect.
解决方案:
The prefix of the remote host name is double slashes.