Tôi đang cố gắng tìm hiểu sự khác biệt trong hành vi giữa FreeBSD ACL và Linux ACLs. Cụ thể, cơ chế kế thừa cho các ACL mặc định.
Tôi đã sử dụng như sau trên cả Debian 9.6 và FreeBSD 12:
$ cat test_acl.sh
#!/bin/sh
set -xe
mkdir storage
setfacl -d -m u::rwx,g::rwx,o::-,m::rwx storage
touch outside
cd storage
touch inside
cd ..
ls -ld outside storage storage/inside
getfacl -d storage
getfacl storage
getfacl outside
getfacl storage/inside
umask
Tôi nhận được đầu ra sau từ Debian 9.6:
$ ./test_acl.sh
+ mkdir storage
+ setfacl -d -m u::rwx,g::rwx,o::-,m::rwx storage
+ touch outside
+ cd storage
+ touch inside
+ cd ..
+ ls -ld outside storage storage/inside
-rw-r--r-- 1 aaa aaa 0 Dec 28 11:16 outside
drwxr-xr-x+ 2 aaa aaa 4096 Dec 28 11:16 storage
-rw-rw----+ 1 aaa aaa 0 Dec 28 11:16 storage/inside
+ getfacl -d storage
# file: storage
# owner: aaa
# group: aaa
user::rwx
group::rwx
mask::rwx
other::---
+ getfacl storage
# file: storage
# owner: aaa
# group: aaa
user::rwx
group::r-x
other::r-x
default:user::rwx
default:group::rwx
default:mask::rwx
default:other::---
+ getfacl outside
# file: outside
# owner: aaa
# group: aaa
user::rw-
group::r--
other::r--
+ getfacl storage/inside
# file: storage/inside
# owner: aaa
# group: aaa
user::rw-
group::rwx #effective:rw-
mask::rw-
other::---
+ umask
0022
Lưu ý rằng các tập tin outsidevà insidecó quyền khác nhau. Cụ thể, outsidetệp có -rw-r--r--, là mặc định cho người dùng này và insidetệp có -rw-rw----, tôn trọng các ACL mặc định mà tôi đã gán storagethư mục.
Đầu ra của cùng một tập lệnh trên FreeBSD 12:
$ ./test_acl.sh
+ mkdir storage
+ setfacl -d -m u::rwx,g::rwx,o::-,m::rwx storage
+ touch outside
+ cd storage
+ touch inside
+ cd ..
+ ls -ld outside storage storage/inside
-rw-r--r-- 1 aaa aaa 0 Dec 28 03:16 outside
drwxr-xr-x 2 aaa aaa 512 Dec 28 03:16 storage
-rw-r-----+ 1 aaa aaa 0 Dec 28 03:16 storage/inside
+ getfacl -d storage
# file: storage
# owner: aaa
# group: aaa
user::rwx
group::rwx
mask::rwx
other::---
+ getfacl storage
# file: storage
# owner: aaa
# group: aaa
user::rwx
group::r-x
other::r-x
+ getfacl outside
# file: outside
# owner: aaa
# group: aaa
user::rw-
group::r--
other::r--
+ getfacl storage/inside
# file: storage/inside
# owner: aaa
# group: aaa
user::rw-
group::rwx # effective: r--
mask::r--
other::---
+ umask
0022
(Lưu ý Debian getfaclcũng sẽ hiển thị các ACL mặc định ngay cả khi không sử dụng -dở đâu như FreeBSD không có, nhưng tôi không nghĩ các ACL thực tế storagekhác nhau.)
Ở đây, các tệp outsidevà insidecũng có các quyền khác nhau, nhưng insidetệp không có quyền ghi nhóm mà phiên bản Debian làm, có lẽ vì mặt nạ trong Debian giữ lại wtrong khi mặt nạ trong FreeBSD bị mất w.
Tại sao FreeBSD mất wmặt nạ nhưng Debian vẫn giữ nó?
g+s) không?
getfaclthông tin.
storage, ls sẽ hiển thị+ , tương tự như tôi mong đợi getfaclđầu ra tương tự như những gì bạn có trên hệ thống Debian. Đã setfacltrả lại mã thoát thành công?
getfacl storagethể hiện trên cả hai hệ thống?