国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 操作系統(tǒng) > 正文

文件基本權(quán)限-ACL

2024-06-28 16:05:04
字體:
供稿:網(wǎng)友

文件權(quán)限管理之: ACL設(shè)置基本權(quán)限(r、w、x)

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

ACL基本用法

設(shè)置:[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權(quán)限[root@localhost ~]# setfacl -m u:jack:- /home/test.txt //增加用戶jack權(quán)限[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權(quán)限

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

 ACL高級用法

mask:用于臨時(shí)降低用戶或組(除屬主和其他人)的權(quán)限建議:為了方便管理文件權(quán)限,其他人的權(quán)限置為空示例:mask值影響用戶權(quán)限的舉例[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打開文件之后無法對文件進(jìn)行修改[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-- 有效權(quán)限:rgroup::---mask::r--other::rwx[alice@localhost ~]$ cat /home/file1 333[alice@localhost ~]$ vim /home/file1 使用vim打開文件之后無法對文件進(jìn)行修改,因?yàn)槲覀兊膍ask值是r,不是空的,所以alice用戶不會(huì)繼承other的權(quán)限[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這個(gè)時(shí)候使用vim打開文件的時(shí)候就可以對文件的內(nèi)容進(jìn)行修改了,因?yàn)閙ask值為空,所以alice會(huì)繼承other的身份總結(jié):mask的值不為空的時(shí)候,單獨(dú)設(shè)置用戶或者是組的acl權(quán)限就受自己的權(quán)限的影響,不包括user(屬主)和other(其他人),但是如果將mask的值設(shè)置為空,單獨(dú)設(shè)置過acl權(quán)限的用戶會(huì)受other的權(quán)限的影響。default: 繼承(默認(rèn))要求: 希望alice能夠?qū)?tmp/dir100以及以后在/tmp/dir100下新建的文件有讀、寫、執(zhí)行權(quán)限[root@localhost tmp]# mkdir dir100[root@localhost tmp]# touch dir100/file1 dir100/file2一: 賦予alice對/tmp/dir100以及目錄下以存在的文件和文件夾讀、寫、執(zhí)行權(quán)限[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下新建的文件有讀、寫、執(zhí)行權(quán)限 (使alice的權(quán)限繼承)[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權(quán)限不能隨便給的,所以系統(tǒng)會(huì)自動(dòng)的將文件的x權(quán)限減掉

[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--


上一篇:管程

下一篇:進(jìn)程調(diào)度算法

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 延安市| 上林县| 资溪县| 华容县| 通化市| 阿克苏市| 凉山| 福州市| 东台市| 东源县| 高雄市| 扎鲁特旗| 铜梁县| 万州区| 射洪县| 应用必备| 无为县| 临清市| 兴城市| 旬阳县| 简阳市| 无锡市| 高碑店市| 上犹县| 长岛县| 会同县| 苗栗县| 青州市| 肥东县| 镇安县| 揭东县| 特克斯县| 吉木乃县| 杂多县| 龙里县| 溆浦县| 岑巩县| 南和县| 海南省| 阜新市| 府谷县|