助け合いフォーラム

LPIC

LPIC Lv1-102(Ver5.0)
問題ID : 4644

正答のオプションが動作しません。

公開日 2023/12/20

こんにちは!

以下の問題(ID:4644)について疑問点があります。

原文

問題

セキュリティ上、SUIDとSGIDのいずれかが設定されたファイルやディレクトリをすべて把握しておきたい。適切なコマンドを選びなさい。

  • find / -perm -6000
  • find / -perm -2000
  • find / -perm +4000
  • find / -perm +6000
  • find / -perm -4000

正解

find / -perm +6000

疑問点

こちらのコマンドを実行したところ、以下の標準エラー出力を得ました。

$ find / -perm +6000
find: invalid mode ‘+6000’

こちらについて、パーミッションの書式が間違っていると思い、manualページ(参考資料のリンク)を確認しました。

find(1) — Linux manual page

前述のページにて 「-perm」を検索したところ、

-perm +mode
Deprecated, old way of searching for files with any of the permission bits in mode set. You should use -perm /mode instead. Trying to use the '+' syntax with symbolic modes will yield surprising results. For example, '+u+x' is a valid symbolic mode (equivalent to +u,+x, i.e. 0111) and will therefore not be evaluated as -perm +mode but instead as the exact mode specifier -perm mode and so it matches files with exact permissions 0111 instead of files with any execute bit set. If you found this paragraph confusing, you're not alone - just use -perm /mode. This form of the -perm test is deprecated because the POSIX specification requires the interpretation of a leading '+' as being part of a symbolic mode, and so we switched to using '/' instead.

と記載されていました。非推奨としてマークされていますが、もう既に実行もできませんでした。

こちらの記載通り

$ find / -perm /6000

を実行したところ正常に稼働し終了コード0で終了しました。

以上のことから問題と回答が古い(2005年以前)のではないかと考えていますが、何か私が見落としている点がありましたらご指摘をお願いします。

また、上記の内容が正確であれば内容を最新のものに更新すると、後にこちらの教材で学ばれる方々にとってより良い教材になると思いますが、いかがでしょうか?一応、昔は正解だったととらえることもできますが、今から学ばれる方にとっては最新の情報に直した方が嬉しいかと考えています。

よろしくお願いします。

スタッフからの返信

s staff_ueda

2023/12/22 10:53

46ki75 様 貴重なご報告をいただきまして、誠にありがとうございます。 古い問題を掲載しており申し訳ございませんでした。 こちらの問題は試験学習用として不備があるため、非公開にさせていただきました。 よろしくお願いいたします。

この投稿に対して返信しませんか?