麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 操作系統 > 正文

文件基本權限-ACL

2024-06-28 16:05:04
字體:
來源:轉載
供稿:網友

文件權限管理之: ACL設置基本權限(r、w、x)

UGO設置基本權限: 只能一個用戶,一個組和其他人ACL 設置基本權限: r,w,x //access Control List 訪問控制列表

ACL基本用法

設置:[root@localhost ~]# touch /home/test.txt[root@localhost ~]# ll /home/test.txt -rw-r--r-- 1 root root 0 10-26 13:59 /home/test.txt[root@localhost ~]# getfacl /home/test.txt[root@localhost ~]# setfacl -m u:alice:rw /home/test.txt //增加用戶alice權限[root@localhost ~]# setfacl -m u:jack:- /home/test.txt //增加用戶jack權限[root@localhost ~]# setfacl -m o::rw /home/test.txt查看/刪除:[root@localhost ~]# ll /home/test.txt -rw-rw-r--+ 1 root root 0 10-26 13:59 /home/test.txt[root@localhost ~]# getfacl /home/test.txt[root@localhost ~]# setfacl -m g:hr:r /home/test.txt[root@localhost ~]# setfacl -x g:hr /home/test.txt //刪除組hr的acl權限

[root@localhost ~]# setfacl -b /home/test.txt //刪除所有acl權限 

 ACL高級用法

mask:用于臨時降低用戶或組(除屬主和其他人)的權限建議:為了方便管理文件權限,其他人的權限置為空示例:mask值影響用戶權限的舉例[root@localhost ~]# touch /home/file1[root@localhost ~]# setfacl -m u:gougou:rw /home/file1 [root@localhost ~]# getfacl /home/file1 getfacl: Removing leading '/' from absolute path names# file: home/file1# owner: root# group: rootuser::rw-user:gougou:rw-group::r--mask::rw-other::r--[root@localhost ~]# setfacl -m m::r /home/file1 [root@localhost ~]# getfacl /home/file1 getfacl: Removing leading '/' from absolute path names# file: home/file1# owner: root# group: rootuser::rw-user:gougou:rw- #effective:r--group::r--mask::r--other::r--[root@localhost ~]# su - gougou[gougou@localhost ~]$ cat /home/file1 [gougou@localhost ~]$ vim /home/file1 

使用vim打開文件之后無法對文件進行修改[root@localhost ~]# setfacl -m o::rwx /home/file1[root@localhost ~]# getfacl /home/file1 getfacl: Removing leading '/' from absolute path names# file: home/file1# owner: root# group: rootuser::---user:alice:rw-group::---mask::rw-other::rwx[root@localhost ~]# setfacl -m m::r /home/file1 [root@localhost ~]# getfacl /home/file1 getfacl: Removing leading '/' from absolute path names# file: home/file1# owner: root# group: rootuser::---user:alice:rw- #effective:r-- 有效權限:rgroup::---mask::r--other::rwx[alice@localhost ~]$ cat /home/file1 333[alice@localhost ~]$ vim /home/file1 使用vim打開文件之后無法對文件進行修改,因為我們的mask值是r,不是空的,所以alice用戶不會繼承other的權限[root@localhost ~]# setfacl -m m::- /home/file1 [root@localhost ~]# getfacl /home/file1 getfacl: Removing leading '/' from absolute path names# file: home/file1# owner: root# group: rootuser::---user:alice:rw- #effective:---group::---mask::---other::rwx[root@localhost ~]# su - alice[alice@localhost ~]$ cat /home/file1 333ddd[alice@localhost ~]$ vim /home/file1這個時候使用vim打開文件的時候就可以對文件的內容進行修改了,因為mask值為空,所以alice會繼承other的身份總結:mask的值不為空的時候,單獨設置用戶或者是組的acl權限就受自己的權限的影響,不包括user(屬主)和other(其他人),但是如果將mask的值設置為空,單獨設置過acl權限的用戶會受other的權限的影響。default: 繼承(默認)要求: 希望alice能夠對/tmp/dir100以及以后在/tmp/dir100下新建的文件有讀、寫、執行權限[root@localhost tmp]# mkdir dir100[root@localhost tmp]# touch dir100/file1 dir100/file2一: 賦予alice對/tmp/dir100以及目錄下以存在的文件和文件夾讀、寫、執行權限[root@localhost ~]# setfacl -R -m u:alice:rwx /tmp/dir100[root@localhost tmp]# getfacl dir100/file1 # file: dir100/file1# owner: root# group: rootuser::rw-user:alice:rwxgroup::r--mask::rwxother::r--[root@localhost tmp]# getfacl dir100/file2 # file: dir100/file2# owner: root# group: rootuser::rw-user:alice:rwxgroup::r--mask::rwxother::r--[root@localhost tmp]# touch dir100/file3[root@localhost tmp]# getfacl dir100/file3 # file: dir100/file3# owner: root# group: rootuser::rw-group::r--other::r--二: 賦予alice對以后在/tmp/dir100下新建的文件有讀、寫、執行權限 (使alice的權限繼承)[root@localhost ~]# setfacl -m d:u:alice:rwx /tmp/dir100[root@localhost tmp]# getfacl dir100/# file: dir100/# owner: root# group: rootuser::rwxuser:alice:rwxgroup::r-xmask::rwxother::r-xdefault:user::rwxdefault:user:alice:rwxdefault:group::r-xdefault:mask::rwxdefault:other::r-x[root@localhost tmp]# touch dir100/file4[root@localhost tmp]# getfacl dir100/file4 # file: dir100/file4# owner: root# group: rootuser::rw-user:alice:rwx #effective:rw-group::r-x #effective:r--mask::rw-other::r--

注意:文件的x權限不能隨便給的,所以系統會自動的將文件的x權限減掉

[root@localhost tmp]# mkdir dir100/dir200[root@localhost tmp]# getfacl dir100/dir200/# file: dir100/dir200/# owner: root# group: rootuser::rwxuser:alice:rwxgroup::r-xmask::rwxother::r-xdefault:user::rwxdefault:user:alice:rwxdefault:group::r-xdefault:mask::rwxdefault:other::r-x[root@localhost tmp]# mkdir dir100/dir200/dir300[root@localhost tmp]# getfacl dir100/dir200/dir300# file: dir100/dir200/dir300# owner: root# group: rootuser::rwxuser:alice:rwxgroup::r-xmask::rwxother::r-xdefault:user::rwxdefault:user:alice:rwxdefault:group::r-xdefault:mask::rwxdefault:other::r-x[root@localhost tmp]# touch dir100/dir200/dir300/file1[root@localhost tmp]# getfacl dir100/dir200/dir300/file1# file: dir100/dir200/dir300/file1# owner: root# group: rootuser::rw-user:alice:rwx #effective:rw-group::r-x #effective:r--mask::rw-other::r--


上一篇:管程

下一篇:進程調度算法

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 色交视频 | 久久激情小视频 | 19禁国产精品福利视频 | 青青草成人影视 | 黄色av网| 国产日韩一区二区三区在线观看 | 少妇的肉体的满足毛片 | 视频一区二区在线播放 | 一级视频网站 | 福利在线免费视频 | 素人视频在线观看免费 | 91九色免费视频 | 人禽l交免费视频观看 视频 | 成人综合区一区 | 亚洲少妇诱惑 | 成人男男视频拍拍拍在线观看 | 九九热精 | 国产成人精品一区在线播放 | 亚洲精品欧美二区三区中文字幕 | 色中色综合网 | 羞羞视频2023 | 国产一级免费电影 | 999精品国产 | 午夜精品久久久久久毛片 | 成人羞羞视频在线观看 | 亚洲国产精品一区二区精品 | 久久777国产线看观看精品 | 久久伊人国产精品 | 久久久一区二区三区四区 | 久久sp| 久久99精品国产 | 成人午夜在线免费观看 | 视频一区免费观看 | 黄色久 | 国产毛片毛片 | 日韩av有码在线 | 国产伦精品一区二区三区 | 国产福利不卡一区二区三区 | 国产精品视频专区 | 成人午夜在线观看视频 | www视频免费在线观看 |