现在的位置: 首页 > 综合 > 正文

System Monitoring之”文件系统”

2013年12月07日 ⁄ 综合 ⁄ 共 1056字 ⁄ 字号 评论关闭
 一、File System Analysis
1、查看文件系统的使用情况:
df -h
2、查看磁盘的使用情况:
du -h:查看当前目录及一级子目录的情况
du -sh:s是summary的意思,表示只查看当前目录的情况
du -ah:查看当前目录及递归显示所有子目录的情况
3、logwatch工具会定时检查log文件,若发现有错误事件的记录,则发送mail至root告知。

二、Set User ID权限和Set Group ID权限带来的安全隐患
1、搜寻系统中所有带uid或gid的文件
find / -type f -perm +6000:加号表示二进制位中为1的数位中有1个1即可。若为减号则是缺一不可。
2、mount磁盘时使用nosuid选项,用来阻止SUID和SGID的权限。
mount -o remount,nosuid /
3、若将某文件的拥有者user对应的帐户从系统中删除,则此文件成为无属主,虽然其拥有者的数字标志依然保留,但使用ls -l无法显示标志位对应的帐户名(已被删除),只能显示一串数字(原帐户的数字标志)。可以通过以下命令查找系统中所有的无属主文件:
find / -nouser
4、更改无属主的文件的owner:
find / -nouser -exec chown root:root {} /;
5、查找所有other具有write的权限的文件或目录:
find / -type f -perm -2:查找文件
find / -type d -perm -2:查找目录

三、文件或目录的特殊属性带来的安全限患
1、特殊属性:
A:atime record is not modified upon access or modification
a:File can only be opened in append mode for writing(root only)
d:File is excluded in backup by dump
i:File is immutable.It cannot be deleted or renamed(root only)
j:File data is recorded on ext3 journal(root only)
S:when the file is modified,the changes are written synchronously to the filesystem
2、查看当前目录下的文件或子目录的特殊属性:
lsattr
3、设置特殊属性
chattr +|-|= attributes <file>
例如发现某病毒文件无法被删除:
首先查看特殊属性:lsattr cracker
然后清除i属性位:chattr cracker -i

抱歉!评论已关闭.