In the Linux environment, use mount.cifs to mount the Windows shared directory

Article Directory

Preface

Embedded development is usually compiled under the linux environment and developed under the windows. This requires accessing the windows directory under the linux environment, or accessing the linux directory on the windows. This chapter will use mount.cifs to mount Windows under the Linux environment. Shared directory.

  1. Create a new shared folder on windows 10, such as elk, and then set the properties of the folder,
    create an elk folder-->Properties-->Share-->Set Share-->Add User (Everyone) to set read and write properties.
    Insert picture description here
    Network and Internet—Network and Sharing Center—Advanced Sharing Settings—All Networks—Turn off password protection
    Insert picture description here
    Insert picture description here
    Control Panel—System Security—Windows Firewall—Custom Settings—Enable or Turn off the firewall—Turn off the firewall
    Insert picture description here

At this point, the directory on windows has been set up, of course, you can also set up password protection, etc.

Finally, you need to turn on the file sharing support in Windows, otherwise an error will be reported, resulting in the failure to mount successfully.
Open the control panel -> Programs and Features -> Start or close the Window function -> Restart to take effect (must restart)
Insert picture description here

When mounting, the address you mounted needs to be consistent with the network card address in the virtual machine

[root@server1 ~]# mount.cifs //192.168.1.1/elk /mnt
Password for root@//192.168.1.1/elk:     #输入电脑用户密码,我的是因为没有所以直接空格就好了
[root@server1 ~]# cd /mnt/
[root@server1 mnt]# ll
总用量 265132
-rwxr-xr-x. 1 root root 33396354 810 2017 elasticsearch-5.5.0.rpm
-rwxr-xr-x. 1 root root 37926436 818 2017 elasticsearch-head.tar.gz
-rwxr-xr-x. 1 root root 52255853 810 2017 kibana-5.5.1-x86_64.rpm
-rwxr-xr-x. 1 root root 94158545 810 2017 logstash-5.5.1.rpm
-rwxr-xr-x. 1 root root 30334692 810 2017 node-v8.2.1.tar.gz
-rwxr-xr-x. 1 root root 23415665 810 2017 phantomjs-2.1.1-linux-x86_64.tar.bz2

View mount record

[root@server1 ~]# df -Th
文件系统          类型      容量  已用  可用 已用% 挂载点
/dev/sda5         xfs        51G  4.6G   47G    9% /
devtmpfs          devtmpfs  898M     0  898M    0% /dev
tmpfs             tmpfs     912M  8.5M  904M    1% /dev/shm
tmpfs             tmpfs     912M   26M  887M    3% /run
tmpfs             tmpfs     912M     0  912M    0% /sys/fs/cgroup
/dev/sda2         xfs       5.0G   61M  5.0G    2% /home
/dev/sda1         xfs      1014M  174M  841M   18% /boot
tmpfs             tmpfs     183M  4.0K  183M    1% /run/user/42
tmpfs             tmpfs     183M   24K  183M    1% /run/user/1000
/dev/sr0          iso9660   4.3G  4.3G     0  100% /run/media/fa/CentOS 7 x86_64
//192.168.1.1/elk cifs      254G   84G  171G   33% /mnt
tmpfs             tmpfs     183M     0  183M    0% /run/user/0

Guess you like

Origin blog.csdn.net/F2001523/article/details/112304405