美文网首页
Linux共享Windows文件夹

Linux共享Windows文件夹

作者: Habit_1027 | 来源:发表于2023-08-30 17:42 被阅读0次

一、在Windows上创建一个共享文件夹

计算机管理-系统工具-共享文件夹-共享-右键 新建共享文件

image.png image.png
查看是否可以访问
image.png

二、Linux服务器上的操作

2.1 安装samba-client客户端以及cifs-utils软件包

[root@localhost ~]# yum install -y samba-client cifs-utils

2.2 创建一个挂载目录

[root@localhost ~]# mkdir -p /opt/windows/tmp

2.3 挂载Windows上的共享目录到Linux下的/opt/windows/tmp目录下

[root@localhost ~]# mount -t cifs   //192.168.6.23/tmp /opt/windows/tmp  -o username=administrator,password=Habits1027,vers=2.0
[root@hrp_hnzl_test ~]# df -h
Filesystem                      Size  Used Avail Use% Mounted on
/dev/mapper/centos_dktest-root   44G   23G   22G  52% /
devtmpfs                        7.8G     0  7.8G   0% /dev
tmpfs                           7.8G     0  7.8G   0% /dev/shm
tmpfs                           7.8G  706M  7.1G   9% /run
tmpfs                           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                      1014M  170M  845M  17% /boot
tmpfs                           1.6G     0  1.6G   0% /run/user/0
//192.168.6.23/tmp              376G  136G  241G  36% /opt/windows/tmp
[root@localhost ~]#

2.4 在/etc/fstab文件中,加入该共享目录的挂载信息

[root@localhost ~]# more /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Tue Aug  7 12:57:15 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos_dktest-root /                       xfs     defaults        0 0
UUID=ba446e41-5098-443c-8995-f273d0f953e2 /boot                   xfs     defaults        0 0
/dev/mapper/centos_dktest-swap swap                    swap    defaults        0 0

//192.168.6.23/tmp /opt/windows/tmp  username=administrator,password=Habits1027
[root@localhost ~]#

2.5 查看Windows共享目录里面的文件

[root@localhost ~]# cd /opt/windows/tmp/
[root@localhost tmp]# ll
total 1001
-rwxr-xr-x 1 root root  72642 Jun 21 14:57 Download_all_packages.xlsx
-rwxr-xr-x 1 root root  14326 May 22 11:38 Flask.md
drwxr-xr-x 2 root root      0 Apr  7 09:38 Microsoft-Activation-Scripts-master
-rwxr-xr-x 1 root root 197986 Apr  7 09:38 Microsoft-Activation-Scripts-master.zip
-rwxr-xr-x 1 root root  16101 May 22 11:38 prometheus-client.md
-rwxr-xr-x 1 root root 708608 Mar  2 16:03 UPCP.dp
-rwxr-xr-x 1 root root    448 Mar  3 10:46 upcp.txt
-rwxr-xr-x 1 root root   7755 Sep  1  2022 配置webSQL.txt
[root@localhost tmp]# 

相关文章

网友评论

      本文标题:Linux共享Windows文件夹

      本文链接:https://www.haomeiwen.com/subject/jblamdtx.html