ディレクトリ構造で不均一なファイル権限を見つける方法は?

ディレクトリ構造で不均一なファイル権限を見つける方法は?

ディレクトリ構造で一様でないファイル/ディレクトリ権限をどのように見つけることができますか?次のようなfindコマンドを試しました。

find /bin ! \( -perm 777 -o -perm 776 -o -perm 775 -o -perm 774 -o -perm 773 -o -perm 772 -o -perm 771 -o -perm 770 -o -perm 760 -o -perm 750 -o -perm 740 -o -perm 730 -o -perm 720 -o -perm 710 -o -perm 700 -o -perm 600 -o -perm 500 -o -perm 400しかし、残りの順列を完了する前に-exec ls -lL {} \;

私も同様のことを手動でやってきました。

ls -lL /bin | grep -v ^-rwxr-xr-x | grep -v ^-rwx--x--x | grep -v ^-rwsr-xr-x | grep -v ^-r-xr-xr-x | grep -v ^-rwxr-xr-tしかし、今回も残りの順列を完了する前にコマンドラインが不足していました。

どちらの方法もとてもぎこちないようです。より良い、より速く、より簡単な方法はありますか?私が使っているシェル(sh)とプラットフォーム(Irix 6.5.22)には制限があります。

ベストアンサー1

実行ファイルをお探しですか?

find . -type f -perm /+x

とにかく、/パターンはおそらくあなたの友達になります...マンページは次のとおりです。

   -perm /mode
          Any  of  the  permission  bits mode are set for the file.  Symbolic modes are accepted in this form.  You must specify `u', `g' or `o' if you use a symbolic mode.  See the
          EXAMPLES section for some illustrative examples.  If no permission bits in mode are set, this test matches any file (the idea here is to be consistent with  the  behaviour
          of -perm -000).

アップデート:そうですね。奇妙な(実行可能な)ものを探しています...

これはうまくいきます(まだfindで3番目のpermパラメータを使用しています)。

サンプル:

$ ls
000  001  002  003  004  005  006  007  010  020  030  040  050  060  070  100  200  300  400  500  600  700

検索コマンド:

$ find . -type f \( -perm /u-x,g+x -o -perm /u-w,g+w -o -perm /u-r,g+r -o -perm /g-x,o+x -o -perm /g-w,o+w -o -perm /g-r,o+r -o -perm /u-x,o+x -o -perm /u-w,o+w -o -perm /u-r,o+r \) | sort
./001
./002
./003
./004
./005
./006
./007
./010
./020
./030
./040
./050
./060
./070

デフォルトでは、グループには権限があるが所有者にはないファイル、世界中には権限があるがグループにはないファイル、世界中には権限があるが所有者にはないファイルを私に与えるという意味です。所有者はそうではありません。

注:findには3つのpermパラメータがあります。

  • パーマモード
  • パーマモード
  • パーマ/モード

psその価値はよくわかりません...

おすすめ記事