Centos7 builds samba, win10 accesses the file path shared by centos7

Centos7 builds samba, win10 accesses the file path shared by centos7

  1. First install samba related services
    yum install -y samba*
  2. Configure the samba configuration file
    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. Configure the upper limit of the number of open system files (because a large number of files will be opened through samba files, so this parameter needs to be modified)
    vim /etc/security/limits.conf
    //文件末尾需要添加如下内容
    * soft nofile 65535
    * hard nofile 65535
    //修改该文件后,需要reboot,这里暂不reboot,后面关闭防火墙后也需要reboot
  4. turn off firewall
    vim /etc/selinux/config                      #永久关闭selinux
    set SELINUX=disabled       #SELINUX=enforcing改为SELINUX=disabled
    //关闭firewall
    systemctl stop firewalld
    systemctl disable firewalld
    //这里需要reboot才能生效
  5. reboot
  6. Start SAMBA
    systemctl restart smb #重启
    systemctl enable smb #修改为开机启动
    systemctl status smb #查看状态
  7. Enter \your samba server ip in the window file browser
  8. Enable network discovery in win10.
    https://jingyan.baidu.com/article/c275f6ba3ef050e33d756702.html
  9. May not be able to access shared folders under 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. complete

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324481265&siteId=291194637