1. 程式人生 > >centos7.4安裝samba服務

centos7.4安裝samba服務

samba

centos7.4安裝samba服務

  • 系統平臺 CentOS Linux release 7.4.1708 (Core)
  • 關閉防火墻,selinux
  • 安裝 samba-4.6.2-8.el7.x86_64 samba-client-4.6.2-8.el7.x86_64
  • 配置/etc/samba/smb.conf
  • 創建共享目錄,本地目錄權限和共享權限
  • 創建系統用戶與共享用戶的密碼
  • 啟動 smb.service
  • 客戶端訪問共享服務器
[root@localhost ~]# cat /etc/redhat-release
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost samba]# systemctl disable firewalld.service
[root@localhost ~]# sed -i ‘s@SELINUX=enforcing@SELINUX=disabled@‘ /etc/selinux/config
[root@localhost samba]# setenforce 0
[root@localhost samba]# yum install samba samba-client -y
[root@localhost samba]# cd /etc/samba/
[root@localhost samba]# cp smb.conf smb.conf.bak
[root@localhost samba]# vim smb.conf
[global]
        workgroup = workgroup
        security = user
        passdb backend = tdbsam
        server string = Samba Server Version %v
        log file = /var/log/samba/log.%m
        max log size = 50
[shared]
        comment = This is a directory of shared
        path = /shared
        valid users = zs
        browseable = yes
        read only = yes
[root@localhost samba]# mkdir /shared
[root@localhost samba]# echo "shared" > /shared/1.txt
[root@localhost samba]# chmod 777 /shared/
[root@localhost samba]# useradd -s /sbin/nologin zs
[root@localhost samba]# chown -R zs:zs /shared/
[root@localhost samba]# smbpasswd -a zs
[root@localhost samba]# systemctl start smb.service
[root@localhost samba]# netstat -tlnp |grep smb

windows客戶端訪問samba服務器ip
技術分享圖片
技術分享圖片
技術分享圖片

centos7.4安裝samba服務