centos7搭建smb服務


1 yum install samba samba-client samba-common -y  安裝smb服務

2 cp -a  /etc/samba/smb.conf /etc/samba/smb.conf.bak   復制配置文件做備份

3 查看selinux狀態   sestatus  命令

4 永久關閉 SeLinux,修改配置文件/etc/selinux/config, vi /etc/selinux/config,將SELINU置為disabled 

確保setlinux關閉,可以用setenforce 0命令執行。 默認的,SELinux禁止網絡上對Samba服務器上的共享目錄進行寫操作,即使你在smb.conf中允許了這項操作。

setenforce 1 設置SELinux 成為enforcing模式

 

setenforce 0 設置SELinux 成為permissive模式  

如果要徹底禁用SELinux 需要在/etc/sysconfig/selinux中設置參數

5 添加系統用戶 useradd zhang   passwd zhang  設置密碼

6 使用smbpasswd –a來建立Samba用戶設置smb密碼,不過要建立的Samba用戶必須先是系統用戶

7 mkdir -p /samba/wwwroot 創建smb目錄

 chmod -R 0755 wwwroot/      給文件加權限
 chown -R zhang:zhang wwwroot/   改變文件所屬者

8 在 /etc/samba/smb.con 添加如下內容

[wwwroot]
        path = /samba/wwwroot
        browseable = yes
        writable = yes
        valid users = zhang

 

9 執行 testparm命令,這時會出現剛才保存內容生成的格式

# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.

 

 

10 啟動smb服務 systemctl start smb.service   開機自啟服務 systemctl enable smb.service

11 關閉防火牆  systemctl stop firewalld  開機自動關閉systemctl disable firewalld.service

 

12 這樣就可以在window是上遠程范文ilnux下的smb服務了,但是訪問的是zhang 家目錄下的文件夾


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM