Centos 7 安裝並配置samba服務


                                      Centos 7 安裝並配置samba服務
(需要root權限運行命令)
一、安裝samba
    yum -y install samba samba-client


二、設置系統用戶(非root)的samba密碼
    smbpasswd -a user
    user爲操作系統的用戶


三、啓動samba
    systemctl start smb

    
四、設置samba開機啓動
    systemctl enable smb

五、本機測試
    testparm

六、關閉防火牆
    臨時關閉防火牆
    systemctl stop firewalld

    永久防火牆開機自啓動
    systemctl disable firewalld

    臨時打開防火牆
    systemctl start firewalld

    防火牆開機啓動
    systemctl enable firewalld

    查看防火牆狀態
    systemctl status firewalld

七、關閉SELinux
    臨時關閉SELinux
    setenforce 0


    臨時打開SELinux
    setenforce 1
    
    開機關閉SELinux
    編輯/etc/selinux/config文件,將SELINUX的值設置爲disabled (不是最後一行)
    
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of three two values:
    #     targeted - Targeted processes are protected,
    #     minimum - Modification of targeted policy. Only selected processes are protected. 
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted 

    查看SELinux狀態
    執行getenforce命令
    
八、Windows訪問

    \\${Samba服務器的IP}\${Samba服務器的系統用戶}    
    
Reference:
    CentOS 7.2 安裝配置Samba服務器
    https://www.linuxidc.com/Linux/2017-03/141390.htm

    CentOS7關閉防火牆和SELinux
    https://jingyan.baidu.com/article/86112f1362a63e2737978719.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章