文件權限管理__3__ACL

ACL(Access Control List) 訪問控制列表

利用文件的擴展屬性,保存了額外的訪問控制權限

一、要使用ACL權限時,需要分區激活ACL功能

RHEL6:默認是激活了ACL功能的

這裏寫圖片描述

給沒有激活ACL功能的分區添加ACL功能

(1)新掛載的分區
這裏寫圖片描述
(2)掛載以後的分區
這裏寫圖片描述

二、與acl權限相關的命令

1、setfacl: 查看文件的訪問控制列表
2、setfacl: 設置文件的訪問控制列表

三、setfacl

1、語法
setfacl [-bkRd]  [-m|-x acl 參數]  目標文件名
2、選項與參數:
-m:設置後續的acl參數,不可與-x一起使用
-b:刪除所有的acl參數
-k:刪除默認的acl參數,針對於目錄
-R:遞歸設置acl參數
-d:設置默認acl參數,只對目錄有效
-x:刪除後續的acl參數,不可與-m一起使用

setfacl -x user_name file_name 刪除針對用戶的參數設定
setfacl -m u:user_name:perms file_name 設定
setfacl -x user_name file_name 刪除訪問控制
setfacl -m u:user_name:perms dir_name 設定訪問控制
setfacl -d -m u::perms dir_name 全局默認
setfacl -m d:u:user_name:perms dir_name 指定用戶默認
setfacl -k dir_name 清楚默認規則
setfacl -m m:perms dir_name
setfacl -R -m u:user_name:perms dir_name
setfacl -b file_name dir_name 清空所有

3、使用方法:
setfacl -m [d] :u[g]:user_name:perms file [directory]

四、getfacl

查看acl訪問控制:
getfacl file_name | dir_name

五、例

對於文件/root/file

1、sxl用戶對文件有讀寫權限,gxx用戶對文件有讀和執行的權限,tom用戶對文件有隻讀的權限

這裏寫圖片描述

2、刪除gxx用戶的訪問控制**

這裏寫圖片描述

3、刪除所有用戶的訪問控制

這裏寫圖片描述

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