[root@mail root]#passwd test3
然后mount一个ext3文件到目录/fs1:
[root@mail root]#mount -t ext3 -o acl /dev/sda1 /fs1
再将test1 建立的文件设置读写的权限给test2 :
[root@mail root]#chmod -R 777 /fs1
让所有的用户都能增加文件到目录的权限:
先用test1登录系统,执行命令:
[test1@mail test1]# cd /fs1
[test1@mail fs1]# echo "Create by test1" > test1.txt
[test1@mail fs1]# chmod go-r test1.txt
[test1@mail fs1]# ll test1.txt
-rw------- 1 test1 test1 17 Jul 14 22:11 test1.txt
而如下操作则可以让除了test1有读写的权限外其他人没有读写test1.txt的权限(root除外),先用test2 登录系统后执行以下命令:
[test2@mail test2]# cd /fs1
[test2@mail fs1]# cat test1.txt
cat : test1.txt Permission denied
接着用test1登录系统,执行如下命令:
[test1@mail fs1]# setfacl -m u:test2:rw test1.txt
这样就修改权限允许test2 有这个文件的读写权限。再看一下它的文件属性的变化:
[test1@mail fs1]# ll
-rw-rw-r--+ 1 test1 test1 10 Feb 16 13:52 test1.txt
会看到后面多了一个“+”,表示这个文件使用ACL的属性设置,再用命令getfacl来看ACL的文件属性设置:
[test1@mail fs1]# getfacl test1.txt
# file: test1.txt
# owner: test1
# group: test1
user::rw-
user:test2:rw-
group::rw-
mask::rw-
other::r--
可以看到 test2 有权限读写这个文件。
我们再用test2登录系统执行以下命令,看看发生了什么?
[test2@mail test2]# cd /fs1
[test2@mail fs1]# cat test1.txt
Create by test1
原来test2可以读取test1.txt文件了。
[test2@mail fs1]# echo "Modify by test2" >> test1.txt
[test2@mail fs1]# cat test1.txt










