linux下的acl許可權使用

來源:互聯網
上載者:User

#

#建立檔案

#

[root@pc f]# cd tmp/testacl
[root@pc testacl]# ls
[root@pc testacl]# touch f1
[root@pc testacl]# echo "aaa" >f1
[root@pc testacl]# cat f1
aaa

#

#建立使用者

#

[root@pc testacl]# useradd usr1
[root@pc testacl]# passwd usr1
[root@pc testacl]# useradd usr2
[root@pc testacl]# passwd usr2
[root@pc testacl]# useradd usr3
[root@pc testacl]# passwd usr3

#

#建立檔案

#
[root@pc testacl]# ll f1
-rw-r--r-- 1 root root 4 2009-03-06 10:00 f1
[root@pc testacl]# chmod 600 f1
[root@pc testacl]# ll f1
-rw------- 1 root root 4 2009-03-06 10:00 f1
 
[root@pc testacl]# setfacl -m u:usr1:r f1
[root@pc testacl]# setfacl -m u:usr2:rw f1
[root@pc testacl]# su usr1
[usr1@pc testacl]$ cat f1
aaa
[usr1@pc testacl]$ echo "bbb" >>f1
bash: f1: Permission denied
 
[usr1@pc testacl]$ su usr2
Password:
[usr2@pc testacl]$ cat f1
aaa
[usr2@pc testacl]$ echo "bbb" >>f1
[usr2@pc testacl]$ cat f1
aaa
bbb
[usr2@pc testacl]$ exit
exit
[usr1@pc testacl]$ exit
exit
 
[root@pc testacl]# getfacl f1
# file: f1
# owner: root
# group: root
user::rw-
user:usr1:r--
user:usr2:rw-
group::---
mask::rw-
other::---
 
[root@pc testacl]# su usr3
[usr3@pc testacl]$ cat f1
cat: f1: Permission denied
[usr3@pc testacl]$ exit
exit
 
[root@pc testacl]# setfacl -x u:usr1 f1
[root@pc testacl]# getfacl f1
# file: f1
# owner: root
# group: root
user::rw-
user:usr2:rw-
group::---
mask::rw-
other::---
 
[root@pc testacl]# su usr1
[usr1@pc testacl]$ cat f1
cat: f1: Permission denied
[usr1@pc testacl]$

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.