如何查找linux系统的特殊权限文件?

1、查找系统中任何用户都有写权限的文件或目录

find / -type f -perm -2 -o -perm -20 |xargs ls -al

查找目录

find / -type d -perm -2 -o -perm -20 |xargs ls –ld

2、查找系统中所有含“s”位的程序

find / -type f -perm -4000 -o -perm -2000 -print | xargs ls –al

3、含有“s”位权限的程序对系统安全威胁很大,通过查找系统中所有具有“s”位权限的程序,可以把某些不必要的“s”位权限的程序去掉,这样可以防止用户滥用权限或提升权限的可能性。

检查系统中所有suid及sgid文件

find / -user root -perm -2000 -print -exec md5sum {} \;
find / -user root -perm -4000 -print -exec md5sum {} \;

4、检查系统中没有属主的文件

find / -nouser -o –nogroup

没有属主的孤儿文件比较危险,往往成为黑客利用的工具,因此在找到这些文件后,要么删除,要么修改文件的属主,使其处于安全状态。

发表评论

后才能评论