Linux中setuid中定期檢查是否有新文件被設置suid權限中,/root/suid.log這個模板文件需要提前將先前已經存在suid權限的文件輸入嗎?
find / -perm -4000 -o -perm -2000 > /temp/setuid.check
for i in $(cat /temp/setsuid.check)
? ? ? ?do?
? ? ? ? ? ? ? ? ?grep &i ?/root/suid.log > /dev/null
? ? ? ? ? ? ? ? ? if[ "$?" !="0" ]
? ? ? ? ? ? ? ? ? ? ? ? ? then?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? echo "$i is a new suidfile!" >> /root/suid_log_$(date +%F)
? ? ? ? ? ? ? ? ? ?fi
done
rm -rf /tmp/setsuid.check
? ? ? ? ? ? ? ? ? ? ??
2017-11-01
是的,有莫板。才能進行對比澀。
2017-03-06
Tony老師的視頻上面是先創(chuàng)建了一個模板文件的, 然后才建立的腳本 vi setuid_check.sh
用的這條命令 在/root/下面建立的suid.log的文件
[root @ localhost ~] # find / -perm -4000 -o -perm -2000 > suid.log
你的腳本里面需要添加
#!/bin/bash
而且這個腳本要定期執(zhí)行的需要在crontb 任務中添加執(zhí)行這個腳本的定期任務