![FreeBSD는 왜 w 마스크를 잃어버렸는데 데비안은 그것을 유지했나요?](https://linux55.com/image/145341/FreeBSD%EB%8A%94%20%EC%99%9C%20w%20%EB%A7%88%EC%8A%A4%ED%81%AC%EB%A5%BC%20%EC%9E%83%EC%96%B4%EB%B2%84%EB%A0%B8%EB%8A%94%EB%8D%B0%20%EB%8D%B0%EB%B9%84%EC%95%88%EC%9D%80%20%EA%B7%B8%EA%B2%83%EC%9D%84%20%EC%9C%A0%EC%A7%80%ED%96%88%EB%82%98%EC%9A%94%3F.png)
FreeBSD ACL과 Linux ACL 간의 동작 차이를 이해하려고 합니다. 특히 기본 ACL의 상속 메커니즘입니다.
Debian 9.6 및 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
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
파일 outside
과 inside
파일의 권한은 다릅니다. 특히, 파일에는 이 사용자의 기본값인 이 outside
있고 파일에는 내가 디렉토리에 할당한 기본 ACL을 준수하는 이 있습니다 .-rw-r--r--
inside
-rw-rw----
storage
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
(Debian은 where를 사용하지 않아도 getfacl
기본 ACL을 표시 -d
하지만 FreeBSD는 그렇지 않지만 실제 ACL은 다르지 않다고 생각합니다 storage
.)
여기서 outside
와 inside
파일도 다른 권한을 가지고 있지만 inside
파일에는 Debian 버전의 그룹 쓰기 권한이 없습니다. 아마도 Debian의 마스크가 유지되기 때문일 것입니다. w
FreeBSD의 마스크가 손실되었습니다 w
.
w
FreeBSD는 왜 마스크를 잃어버렸 는데 데비안은 마스크를 유지했나요?
답변1
간단히 말해서, 그들이 umask를 다르게 사용한다고 가정하겠습니다.
0022는 정확히 그룹-기타가 설정되지 않은 W입니다. umask를 변경하여 쓰기 금지를 비활성화하고 결과를 확인할 수 있습니다.
Solaris라고도 알려진 SunOS 매뉴얼(및 설명)에서 인용한 내용은 매우 관련성이 있어 보입니다. "...디렉토리에 기본 ACL 항목이 포함된 경우 umask(1)는 적용되지 않습니다. ..."