Linux

監視或記錄目錄權限更改?

  • October 7, 2012

我在執行 CentOS 5 的 cPanel 共享伺服器上遇到問題,其中 public_html 文件夾下的一些目錄不斷從 755 更改為 777。客戶說他們沒有更改它,我想知道是否有辦法監控這些特定的目錄來找出誰/什麼在改變權限。

我已經研究過使用 auditctl 並在對其進行測試並自己更改權限後,我在日誌中看不到任何內容,所以我不確定我是否做對了,或者是否有可能。

是否有人對我如何找出更改權限的內容有任何建議或想法?

謝謝!!

auditd 為我工作..

創建了一個名為 /var/www/html/1 的文件

編輯 /etc/audit/audit.rules 並添加以下內容並重新啟動 auditd。

-w /var/www/html/1

然後執行以下命令。

# chmod 777 /var/www/html/1

在 /var/log/audit/audit.log 我看到以下內容,

type=SYSCALL msg=audit(1349582090.742:414): arch=c000003e syscall=268 success=yes exit=0 a0=ffffffffffffff9c a1=17be0f0 a2=1ff a3=4000 items=1 ppid=2859 pid=3069 auid=1001 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=2 comm="chmod" exe="/usr/bin/chmod" subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null)
type=CWD msg=audit(1349582090.742:414):  cwd="/root"
type=PATH msg=audit(1349582090.742:414): item=0 name="/var/www/html/1" inode=6171184 dev=fd:00 mode=040755 ouid=0 ogid=0 rdev=00:00 obj=unconfined_u:object_r:httpd_sys_content_t:s0

在 Fedora 17 中測試。

引用自:https://serverfault.com/questions/434483