如果***获得并改变了一些系统文件,这些系统文件就会成为安全漏洞。任何人都有写权
限的目录也同样有危险,因为***可以根据他们的需要自由地添加或删除文件。在正常情况下
有些文件是可写的,包括一些“ /dev”目录下的文件和符号连接。
在系统中定位任何人都有写权限的文件和目录可以使用下面的命令:
[root@Aid]# find / -type f \( -perm -2 -o -perm -20 \) -exec ls -lg {} \;
[root@Aid]# find / -type d \( -perm -2 -o -perm -20 \) -exec ls -ldg {} \;
注意 像Tripware软件这样的文件和目录完整性检查器能够扫描、管理和方便地发现改变过的任何人都有写权限的文件。
发现没有所有者的文件就意味着有******系统了。不能允许没有所有者的文件存在。如果在系统中发现了没有所有者的文件或目录,先查看它的完整性,如果一切正常,给它一个所有者。有时候卸载程序可能会出现一些没有所有者的文件或目录,在这种情况下可以把这些文件和目录删除掉。
定位系统中没有所有者的文件可以使用下面的命令:
[root@Aid]# find / -nouser -o -nogroup
注意 不用管“ /dev”目录下的那些文件。
查找“ .rhosts”文件是日常管理工作的一部分,因为这些文件不允许存在于系统中。记住,
***只要有系统中的一个账号就可能***整个网络。
可以用下面的命令定位系统中的“ .rhosts”文件:
[root@Aid]# find /home -name .rhosts
也可以用一个 cron任务定期地查看、报告和删除 $HOME/.rhosts文件。同时,也必须让用户
知道会经常地进行这种审核。
用 r o o t身份在“ / e t c / c r o n . d a i l y”目录下,创建“ f i n d _ r h o s t s _ f i l e s”脚本文件( t o u c h
/etc/cron.daily/find_rhosts_files),并在脚本文件中加入下面几行:
#!/bin/sh
/usr/bin/find /home -name .rhosts | (cat <<EO
.This is an automated report of possible existent ".rhosts" files on the server
deep.openarch.com, generated by the find utility command.
New detected ".rhosts" files under the "/home" directory include:
EOF
Cat
) | /bin/mail -s "Content of .rhosts file audit report" root
然后,让这个脚本可执行,把所有者和组设置成 root:
[root@Aid]# chmod 755 /etc/cron.daily/find_rhosts_files
[root@Aid]# chown 0.0 /etc/cron.daily/find_rhosts_files
每天都会有一份主题为 Content of .rhosts file audit report的邮件发给 root,报告新发现的
“.rhosts”文件。
转载于:https://blog.51cto.com/redhat2008/981577