系统管理工具包: 测试系统的有效性

http://tech.ddvip.com   2008年11月11日    社区交流

关键字: Rexx GPFS SMBFS NFS JFS RPC

研究存储配置文件和后期检查其有效性的方法。尽管您已经拥有各种安全系统,但是某些人仍可能访问您的系统,并更改您的配置或安全设置。

  您可以像前面一样在相同文件上运行脚本,并且应该获得完全相同的信息,如清单 4 所示。

  清单 4. 在相同的文件上运行 Digest::MD5

$ simpmd5.pl old new
old -> 602f604720d3b57925e99bcaa7d931a4
new -> c3f06c217a0f26c16f8d030837d8718b

  为使此流程派上用场,需要将信息记录到文件中,这样可以将该信息与以后的信息进行比较。在执行此操作之前,将需要比较的其他信息(修改时间、文件大小、所有权、索引节点等)添加到存储数据中。

  将其他数据添加到报告中

  Perl stat() 函数可以从给定的文件获取完整的信息(可以使用其中的大多数信息)。清单 5 显示了可以从该文件获取的信息列表。

  清单 5. Perl stat() 函数

0 dev   device number of filesystem
1 ino   inode number
2 mode   file mode (type and permissions)
3 nlink  number of (hard) links to the file
4 uid   numeric user ID of file's owner
5 gid   numeric group ID of file's owner
6 rdev   the device identifier (special files only)
7 size   total size of file, in bytes
8 atime  last access time in seconds since the epoch
9 mtime  last modify time in seconds since the epoch
10 ctime  inode change time in seconds since the epoch (*)
11 blksize preferred block size for file system I/O
12 blocks  actual number of blocks allocated

  您几乎可以记录所有这些信息,但是其中一些信息是毫无使用价值的,因为这些信息或者更改得太频繁,或者在重新启动过程中不一致。应该忽略以下字段:

来源:ibm    作者:Martin C Brown    责编:豆豆技术应用

正在加载评论...