大家在使用rhel6的時候,用ls -l命令檢視檔案的許可權的時候,你可能會發現,這個許可權的表示內容,已經與以前的版本不一樣了,後面多了乙個點,這個點是幹嗎的呢?搜尋了很久也沒有找到答案,很是鬱悶啊!於是乎就只能自己慢慢研究。
首先來看看我是如何找到答案的,這個也是我的思路,和大家分享一下。
1、直接在網上搜尋,但都找不到答案。
2、懷疑會不會像網域名稱一樣,來用個點來表示結尾呢?
3、懷疑這個可能是和許可權有關,想到了acl和selinux。
4、懷疑和檔案系統有關,因為rhel6已經用了ext4。
這些都是我想到的,可能和這個點有關的,猜測是可以的,但絕對不能誤導別人,所以我就一一來排除和驗證,最終得到結果是:
這個點表示的是存在「selinux的安全標籤」!
為什麼會這樣,我們來看如何得出來的結果。
我們用getenforce來檢視selinux的執行模式
[root@tonyzhang ~]# getenforce
enforcing
這說明selinux是啟動的,ok,我們來建立個檔案
[root@tonyzhang ~]# touch testfile
[root@tonyzhang ~]# ls -l testfile
-rw-r--r--. 1 root root 0 jan 16 23:06 testfile
我們看到這個檔案的許可權後面是有點的。
下面我們關閉這個selinux,然後重新啟動系統
[root@tonyzhang ~]# vim /etc/sysconfig/selinux
將selinux=enforcing
改為selinux=disabled
儲存退出,重新啟動系統。
重新進入系統後,我們再來看一下這個selinux的執行模式
[root@tonyzhang ~]# getenforce
disabled
再來建立個檔案
[root@tonyzhang ~]# touch testfile1
比較一下這兩個檔案
[root@tonyzhang ~]# ls -l testfile*
-rw-r--r--. 1 root root 0 jan 16 23:06 testfile
-rw-r--r-- 1 root root 0 jan 16 23:10 testfile1
發現testfile1這個許可權的後面沒有了點
再來看看這兩個檔案的安全上下文是什麼樣的
[root@tonyzhang ~]# ls -z testfile*
-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 testfile
-rw-r--r-- root root ? testfile1
關掉了selinux,建立的檔案就沒有了這個安全上下文了,也就沒有了這個點了。
我們再看看,把selinux開啟,再重新啟動電腦,看看這個testfile1的安全上下文會變成什麼樣?
[root@tonyzhang ~]# ls -z testfile*
-rw-r--r--. root root system_u:object_r:admin_home_t:s0 testfile
-rw-r--r--. root root system_u:object_r:admin_home_t:s0 testfile1
重新啟動後,這個testfile1檔案就自動加上了這個安全標籤,而且許可權的後面又多了乙個點。
至於testfile這個檔案的安全上下文為什麼會變,我們後面學習selinux的時候,慢慢來研究了。
可見,我們上面的分析是完全正確的,這也同時說明乙個問題,rhel6的安全性提高了。
RHEL6基礎四十九之RHEL檔案(夾)許可權高階篇
acl許可權管理 acl access control list,訪問控制列表 主要是提供傳統的owner,group,others的read,write,execute許可權之外的具體許可權設定,acl可以針對單一使用者 單一檔案或目錄來進行r,w,x的許可權控制,對於需要特殊許可權的使用狀況有一...
關於RHEL6中ulimit的nproc限制
root kumu ulimit a 檢視當前配置檔案ulimit全域性係數 core file size blocks,c 0 data seg size kbytes,d unlimited scheduling priority e 0 file size blocks,f unlimited...
RHEL 6 和 RHEL 7 的一些區別
system v init 執行級別 systemd 目標名稱作用0 runlevel0.target,poweroff.target關機 1runlevel1.target,rescue.target單使用者模式 2runlevel2.target,multi user.target等同於級別 3...