特定のディレクトリのグループセクションで、どのファイルに特定の権限フラグがあるかをどのように確認できますか?

特定のディレクトリのグループセクションで、どのファイルに特定の権限フラグがあるかをどのように確認できますか?

私はディレクトリを持っており、どのグループに属しているかに関係なく、そのグループセクションに書き込み権限を持つすべてのファイルを一覧表示したいと思います。

また、ファイルシステム全体でどのように実行できますか?

ベストアンサー1

find述語と一緒に使用できます-perm。 ~からman find(POSIX):

-perm [-]mode

      The mode argument is used to represent file mode bits. It  shall
      be identical in format to the symbolic_mode operand described in
      chmod() , and shall be interpreted  as  follows.   To  start,  a
      template shall be assumed with all file mode bits cleared. An op
      symbol of '+'  shall  set  the  appropriate  mode  bits  in  the
      template;  '-'  shall  clear the appropriate bits; '=' shall set
      the appropriate mode bits, without regard  to  the  contents  of
      process' file mode creation mask. The op symbol of '-' cannot be
      the first character of mode;  this  avoids  ambiguity  with  the
      optional leading hyphen. Since the initial mode is all bits off,
      there are not any symbolic modes that need to  use  '-'  as  the
      first character.

If  the  hyphen is omitted, the primary shall evaluate as true when the
file permission bits exactly match the value of the resulting template.

Otherwise, if mode is prefixed by a hyphen, the primary shall  evaluate
as  true  if at least all the bits in the resulting template are set in
the file permission bits.

したがって、次のことを試すことができます。

find /some/path/ -type f -perm -g=w

-type f一般ファイルをテストします。完全なファイルシステム/some/pathについて/

おすすめ記事