1. 程式人生 > >centos7 搭建 samba,win10訪問centos7共享的文件路徑

centos7 搭建 samba,win10訪問centos7共享的文件路徑

samba win10

centos7 搭建 samba,win10訪問centos7共享的文件路徑
  1. 首先安裝samba相關的服務
    yum install -y samba*
  2. 配置samba的配置文件
    cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
    vim /etc/samba/smb.conf
    //修改配置文件smb.conf的內容為下述內容
    [global]
    log file = /var/log/samba/log.%m
    max log size = 50
    security = user
    map to guest = Bad User
    [sambadir]
    path=/home/
    readonly=yes
    browseable=yes
    writable = yes 
    guest ok=yes
  3. 配置系統文件打開數目上限(因為後續會通過samba文件打開大量文件,所以需要修改此參數)
    vim /etc/security/limits.conf
    //文件末尾需要添加如下內容
    * soft nofile 65535
    * hard nofile 65535
    //修改該文件後,需要reboot,這裏暫不reboot,後面關閉防火墻後也需要reboot
  4. 關閉防火墻
    vim /etc/selinux/config                      #永久關閉selinux
    set SELINUX=disabled       #SELINUX=enforcing改為SELINUX=disabled
    //關閉firewall
    systemctl stop firewalld
    systemctl disable firewalld
    //這裏需要reboot才能生效
  5. reboot
  6. 啟動SAMBA
    systemctl restart smb #重啟
    systemctl enable smb #修改為開機啟動
    systemctl status smb #查看狀態
  7. 在window文件瀏覽器裏輸入\your samba server ip
  8. win10 下開啟網絡發現。
    https://jingyan.baidu.com/article/c275f6ba3ef050e33d756702.html
  9. win10下可能無法訪問共享文件夾解決
    //管理員權限進入cmd
    //開啟SMBv1
    sc.exe config lanmanworkstation depend= bowser/mrxsmb10/mrxsmb20/nsi 
    sc.exe config mrxsmb10 start= auto
    //關閉SMBv2 and SMBv3
    sc.exe config lanmanworkstation depend= bowser/mrxsmb10/nsi 
    sc.exe config mrxsmb20 start= disabled
    (需要重啟win10)
  10. 完畢

centos7 搭建 samba,win10訪問centos7共享的文件路徑