どのプログラムが私のファイルを読んでいるのか、どうすればわかりますか?

どのプログラムが私のファイルを読んでいるのか、どうすればわかりますか?

構成ファイルがあり、どの実行可能ファイルがそれを使用しているかを知りたい(存在する場合)。このファイルを読んでいる人が誰であるかを知りたいです。

ちょっとした間隔があると、watch読み込みが早すぎるので見逃します。

watch -d -n 1 "lsof /home/me/my.conf"

のサポートを受けて使用しているこのプログラムを実行しようとすると、追加のstrace待ち時間が発生して失敗しますstrace

strace -o /tmp/$(date +%s)_myprog.trace myprog

myprogファイルを読んでいないことをどのようにして確実に証明できますか?

ベストアンサー1

どのファイルがプロセスによって開かれるか、またはどのプロセスがsysdig

~からsysdigの例ページ

デフォルトopensnoop:発生時に開かれるファイルを待機

sysdig -p "%12user.name %6proc.pid %12proc.name %3fd.num %fd.typechar %fd.name" evt.type=open

my.confというすべてのファイルのI / Oアクティビティを観察します。

sysdig -A -c echo_fds "fd.filename=my.conf"

システム販売者

名前 sysdig - 最終システムとプロセスのトラブルシューティングツール

概要 sysdig [オプション]... [フィルタ]

説明する。

   sysdig is a tool for  system  troubleshooting,  analysis  and  explo‐
   ration.   It  can  be used to capture, filter and decode system calls
   and other OS events.
   sysdig can be both used to inspect live systems, or to generate trace
   files that can be analyzed at a later stage.

   sysdig  includes  a powerul filtering language, has customizable out‐
   put, and can be extended through Lua scripts, called chisels.

おすすめ記事