
acl이 설정된 모든 파일을 찾고 싶습니다. 나는 이 더러운 해결책을 알고 있습니다. acl이 설정된 디렉토리에서 모든 파일을 찾으십시오. /등
sudo ls -lhR /etc|grep +
더 우아한 솔루션을 아는 사람이 있습니까?
답변1
단순성과 우아함은 매우 높은 기준이며, 솔루션 +
에 파일 이름(예: C++)이 있으면 더티 솔루션은 실패합니다.
또 다른 방법은 getfacl
ACL 없이 파일을 건너뛰어 재귀적으로 사용하는 것 입니다.
getfacl -Rs /your/dir | grep "# file:"
그러면 파일이 나열되고 파일 이름만 grep됩니다.
답변2
그리고sfind
또는 find
내장bosh
쉘, 그것은 단지 :
sfind . -acl
bosh -c 'find . -acl'
-acl The primary evaluates as true if the file has addi- tional ACLs defined. On platforms that do not support ACLs or where sfind does not yet support ACLs, the pri- mary always evaluates as false. Currently only Solaris, Linux and FreeBSD is supported.
sfind
그리고 둘 bosh
다힐리 도구.
같은 것을 얻으십시오getfacl
GNU 시스템에서 일반적으로 발견되는 명령,확립된에두아르도의 대답, 다음과 같이 파일 필드(representation 및 as를 사용하여 일부 바이트 값을 인코딩함 getfacl
)를 디코딩해야 합니다.\ooo
\
\\
getfacl -Rs . | perl -nle '
if (/^# file: (.*)/) {
print $1 =~ s{\\(\\|[0-7]{3})}{
$1 eq "\\" ? "\\" : chr oct $1}ger
}'
find
이 파일 목록으로 작업을 수행하려면 's here 를 사용할 수 없으므로 -exec
NUL로 구분된 목록을 인쇄해야 합니다.
getfacl -Rs . | perl -nl0e '
if (/^# file: (.*)/) {
print $1 =~ s{\\(\\|[0-7]{3})}{
$1 eq "\\" ? "\\" : chr oct $1}ger
}'
따라서 xargs -r0 some-command
(zsh) 또는 (bash 4.4+)를 사용하여 파이프하거나 배열에 저장할 수 있습니다.array=( ${(0)"$(cmd)"} )
readarray -td '' < <(cmd)