a亚洲精品_精品国产91乱码一区二区三区_亚洲精品在线免费观看视频_欧美日韩亚洲国产综合_久久久久久久久久久成人_在线区

首頁 > 學(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ā)表
主站蜘蛛池模板: 免费黄色福利网站 | 中文字幕一二区 | 国产精品1 | 欧美视频网站 | 午夜免费观看网站 | 久在线观看| 天天插天天 | 黄色国产视频 | 羞羞av在线 | 99这里只有精品 | 国产精品视频在线观看 | 久久久久久网站 | 看亚洲a级一级毛片 | heyzo在线观看| 91嫩草在线| 久久va| 国产一区二区三区高清 | 成人在线免费 | 久久久夜色 | 久久亚洲精品中文字幕蜜潮电影 | 久久国产精品视频 | 中文字幕日韩在线 | 激情婷婷 | 9999在线视频 | 欧美一区免费 | 日韩欧美国产一区二区 | 日本五月婷婷 | 日韩综合网 | 黄色影院在线观看 | 日韩在线观看 | 日本在线一区 | 国产激情偷乱视频一区二区三区 | 亚洲精品乱码久久观看网 | 亚洲成人免费 | 国产91成人video | 国产精品污www在线观看 | 男女看片黄全部免费 | 成人av观看 | 国产精品欧美三级在线观看 | www.国产精品 | 成年人在线观看 |