歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> Centos Samba 服務器 iptables 和 SElinux 設置,centosiptables

Centos Samba 服務器 iptables 和 SElinux 設置,centosiptables

日期:2017/3/6 9:23:21   编辑:學習Linux

Centos Samba 服務器 iptables 和 SElinux 設置,centosiptables


Centos Samba 服務器 iptables 和 SElinux 設置,centosiptables


1.安裝samba服務器

 # yum install samba


2.配置

 # vi /etc/samba/smb.conf
  security = user (100行左右)

  在Share Definitions下
  注釋以下的所有配置文件

  添加以下幾行
  [共享的名字(如果linux支持中文,可以寫中文)]
  path = 你需要共享的路徑
  browseable = yes
  writable = yes


3.新建用戶名,新建文件夾並且設定ACL權限

 # useradd -s /sbin/nologin -M 你需要新建的用戶名
 mkdir -p 在配置(2)中,存放文件的路徑


ACL:
 1.查看是否具有ACL權限    

  # mount | grep -i "acl" | grep -v "grep"


 2.如果1什麼也沒輸出 那麼就需要添加權限

  # vi /etc/fstab


  在/ 那一欄中 磁盤格式後 配置前添加上acl即可

  完成之後需要重啟(請設置好,不要不能開機哦!!!)
  或者

   # mount / -o remount

 3.配置acl

  # setfacl -m -u:用戶名:權限(rwx權限) 目錄
 例如:
  # setfacl -m -u:test1:r-x /share


 4.查看acl權限

  # getfacl 需要查看的目錄


4.iptables的設定

  # iptables -I INPUT -p tcp -dport 139 -j ACCEPT
  # iptables -I INPUT -p tcp -dport 445 -j ACCEPT

 注:
 139 445端口必須打開
  如果需要用到計算機名來訪問,則需要打開137 138端口,
  不過,基本上用不到,打開以上兩個端口進行Ip訪問即可。

 保存和重啟防火牆

  # /etc/init.d/iptables save && /etc/init.d/iptables reload

5.SEliux設定
 查看規則

  # getsebool -a | grep "samba"



 配置

 配置根據smb.conf配置文件中所提到的內容

 

  # setsebool -P samba_create_home_dirs=on && setsebool -P samba_domain_controller=on &


6.測試即可

Time : 2016-08-10 23:22:04

Name: 王 李

Mail:[email protected]

http://xxxxxx/Linuxjc/1148744.html TechArticle

Copyright © Linux教程網 All Rights Reserved