selinux 基於
samba
需要修改的內容
[root@server1 pub]# mkdir /ccc
[root@server1 pub]# chmod 777 /ccc
[root@server1 pub]# ls -z /etc/samba/
-rw-r--r--. root root system_u:object_r:samba_etc_t:s0 lmhosts
-rw-r--r--. root root system_u:object_r:samba_etc_t:s0 smb.conf
-rw-r--r--. root root system_u
:object_r:
samba_etc_t
:s0 smbusers
[root@server1 pub]# ll -z /ccc/
drwxr-xr-x. nobody nobody unconfined_u
:object_r:
default_t
:s0 /ccc
[root@server1 pub]# chcon -u system_u /ccc/
[root@server1 pub]#chcon -t samba_etc_t /ccc/
[root@server1 pub]# ll -zd /ccc/
drwxrwxrwx. root root system_u:object_r:samba_etc_t:s0 ccc
同時需要開啟布林值
[root@server1 /]# getsebool -a | grep samba
samba_create_home_dirs --> off
samba_domain_controller --> off
samba_enable_home_dirs --> off
samba_export_all_ro --> off
samba_export_all_rw --> off
samba_run_unconfined --> off
samba_share_fusefs --> off
samba_share_nfs --> off
use_samba_home_dirs --> off
virt_use_samba --> off
[root@server1 /]# setsebool -p
usage: setsebool [ -p ] boolean value | bool1=val1 bool2=val2...
[root@server1 /]# setsebool -p samba_enable_home_dirs on
[root@server1 /]# setsebool -p samba_export_all_rw 1
selinux 基於
apache
的策略1.
關閉iptables
# service iptables status
iptables: firewall
is running.
# service iptables
stop
2. 啟動selinux
[root@allentuns ~]#
cat
/etc/sysconfig/selinux
| grep
「selinux=」
selinux=enforcing
3. 安裝httpd服務#
4. 修改httpd
配置檔案
5. 啟動httpd
服務# service httpd start
#修改一行
servername localhost:80
6. 測試【1
】7.
建立新的web
目錄#mkdir /www
#cd /www/
# echo ''
>
index.html
8. 刪除apache
的歡迎頁面,重新啟動
httpd服務#
9. 測試【2
】10. 使用新建立的
web頁面
#修改一下兩行
12. 測試【3】
13. 為什麼會沒有許可權呢?
這個時候我們關閉selinux
,在來繼續訪問
#setenforce 0
#getenforce
permissive
14. 測試【4】
看來真是selinux
的問題,我們開啟
selinux
,然後通過修改
selinux
對檔案的屬性來訪問服務
# setenforce 1
# getenforce
enforcing
16.檢視檔案對應的
selinux
屬性值#ls -z
-rw-r--r--. root root
unconfined_u:object_r:default_t:s0
index.html
17. 通過
chcon
修改對應的屬性值
18. 測試【5】
大家也看到了吧 在開啟selinux
的情況下 修改修改文字的屬性值,也可以保證服務的安全
!!
學習Python 第十二天
列表 鍊錶 1 棧 filo 先進後出 2 佇列 fifo 先進先出 普通佇列 class myquene object def init self,list self.list list def size self return len self.list def delete self if s...
Java學習第十二天
2019 05 09 晴一 容器 可變長的,任意資料型別的資料的集合 二 集合 collection 五 vector 向量 底層 雙向鍊錶實現 優點 做增刪效率高 缺點 查詢和遍歷效率低 新增功能 新增了一些操作與頭部和尾部的方法 set 介面 無序的 不可重複 放入資料的順序和內部真實儲存的順序...
學習Python第十二天
if else語句 if 條件為真 執行命令1 else 執行命令2while else 語句 a 0while a 5 print a,是大於5的數 a 1else print a,是小於或等於5的數 10 是大於5的數 9 是大於5的數 8 是大於5的數 7 是大於5的數 6 是大於5的數 5 ...