Whamcloud - gitweb
LU-8277 scripts: add missing commas in checkpatch.pl
[fs/lustre-release.git] / lustre / tests / rmtacl / setfacl.test
1 Setfacl utility tests. Run these tests on a filesystem with ACL support.
2  
3         $ mkdir d
4         $ chown bin:bin d
5         $ cd d
6
7         $ su bin
8         $ sg bin
9         $ umask 027
10         $ touch g
11         $ lfs ls -dl g | awk '{print $1}'
12         > -rw-r-----
13         
14         $ lfs lsetfacl -m m:- g
15         $ lfs ls -dl g | awk '{print $1}'
16         > -rw-------+
17         
18         $ lfs lgetfacl g
19         > # file: g
20         > # owner: bin
21         > # group: bin
22         > user::rw-
23         > group::r--    #effective:---
24         > mask::---
25         > other::---
26         > 
27         
28         $ lfs lsetfacl -x m g
29         $ lfs lgetfacl g
30         > # file: g
31         > # owner: bin
32         > # group: bin
33         > user::rw-
34         > group::r--
35         > other::---
36         > 
37         
38         $ lfs lsetfacl -m u:daemon:rw g
39         $ lfs lgetfacl g
40         > # file: g
41         > # owner: bin
42         > # group: bin
43         > user::rw-
44         > user:daemon:rw-
45         > group::r--
46         > mask::rw-
47         > other::---
48         > 
49         
50         $ lfs lsetfacl -m u::rwx,g::r-x,o:- g
51         $ lfs lgetfacl g
52         > # file: g
53         > # owner: bin
54         > # group: bin
55         > user::rwx
56         > user:daemon:rw-
57         > group::r-x
58         > mask::rwx
59         > other::---
60         > 
61         
62         $ lfs lsetfacl -m u::rwx,g::r-x,o:-,m:- g
63         $ lfs lgetfacl g
64         > # file: g
65         > # owner: bin
66         > # group: bin
67         > user::rwx
68         > user:daemon:rw-       #effective:---
69         > group::r-x    #effective:---
70         > mask::---
71         > other::---
72         > 
73         
74         $ lfs lsetfacl -m u::rwx,g::r-x,o:-,u:root:-,m:- g
75         $ lfs lgetfacl g
76         > # file: g
77         > # owner: bin
78         > # group: bin
79         > user::rwx
80         > user:root:---
81         > user:daemon:rw-       #effective:---
82         > group::r-x    #effective:---
83         > mask::---
84         > other::---
85         > 
86         
87         $ lfs lsetfacl -m u::rwx,g::r-x,o:-,u:root:-,m:- g
88         $ lfs lgetfacl g
89         > # file: g
90         > # owner: bin
91         > # group: bin
92         > user::rwx
93         > user:root:---
94         > user:daemon:rw-       #effective:---
95         > group::r-x    #effective:---
96         > mask::---
97         > other::---
98         > 
99         
100         $ lfs lsetfacl -m u::rwx,g::r-x,o:-,u:root:- g
101         $ lfs lgetfacl g
102         > # file: g
103         > # owner: bin
104         > # group: bin
105         > user::rwx
106         > user:root:---
107         > user:daemon:rw-
108         > group::r-x
109         > mask::rwx
110         > other::---
111         > 
112         
113         $ lfs lsetfacl --test -x u: g
114         > setfacl: g: Malformed access ACL `user:root:---,user:daemon:rw-,group::r-x,mask::rwx,other::---': Missing or wrong entry at entry 1
115         
116         $ lfs lsetfacl --test -x u:x
117         > setfacl: Option -x: Invalid argument near character 3
118         
119         $ lfs lsetfacl -m d:u:root:rwx g
120         > setfacl: g: Only directories can have default ACLs
121         
122         $ lfs lsetfacl -x m g
123         > setfacl: g: Malformed access ACL `user::rwx,user:root:---,user:daemon:rw-,group::r-x,other::---': Missing or wrong entry at entry 5
124          lfs lsetfacl --test -m d:u:daemon:rwx lfs lsetfacl
125          lfs lsetfacl --test -n -m d:u:daemon:rwx lfs lsetfacl
126         
127 Check if the mask is properly recalculated
128  
129         $ mkdir d
130         $ lfs lsetfacl --test -m u::rwx,u:bin:rwx,g::r-x,o::--- d
131         > d: u::rwx,u:bin:rwx,g::r-x,m::rwx,o::---,*
132         
133         $ lfs lsetfacl --test -m u::rwx,u:bin:rwx,g::r-x,m::---,o::--- d
134         > d: u::rwx,u:bin:rwx,g::r-x,m::---,o::---,*
135         
136         $ lfs lsetfacl --test -d -m u::rwx,u:bin:rwx,g::r-x,o::--- d
137         > d: *,d:u::rwx,d:u:bin:rwx,d:g::r-x,d:m::rwx,d:o::---
138         
139         $ lfs lsetfacl --test -d -m u::rwx,u:bin:rwx,g::r-x,m::---,o::--- d
140         > d: *,d:u::rwx,d:u:bin:rwx,d:g::r-x,d:m::---,d:o::---
141         
142         $ su
143         $ cd ..
144         $ rm -r d