[root@localhost ~]# setfacl -b /home/test.txt //刪除所有acl權限
使用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--
新聞熱點
疑難解答