Article Title: Simple System File verification in Linux. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic categories, write a simple script, and regularly perform integrity verification for specific system files, use the md5sum tool in Linux to verify the MD5 of files in a specific directory.
#!/bin/bash # Write By LouLanCN@163.com md5sum="/usr/bin/md5sum" md5f=SysCheck-`date +%F`.md5 fs="/etc /etc/sysconfig /bin /sbin /usr/bin /usr/sbin" for d in $fs do for f in `ls $d` do $md5sum $d/$f >> $md5f done done
|
Here are several notes:
1. The md5sum file must be backed up in another safe place in advance
2. For the generated md5f (such as SysCheck-2008-01-27.md5) file, it must also be stored in another safe place, during verification and then downloaded to the local use
[root@lapp ~]# ./m5 -c SysCheck-2008-01-27.md5 |more /etc/adjtime: OK /etc/aliases: OK /etc/aliases.db: OK /etc/anacrontab: OK /etc/at.deny: OK /etc/auditd.conf: OK /etc/audit.rules: OK /etc/auto.master: OK /etc/auto.misc: OK /etc/auto.net: OK /etc/bashrc: OK /etc/bg5ps.conf: OK /etc/bg5ps.conf.zh_CN: OK /etc/bg5ps.conf.zh_CN.GB2312: OK /etc/bg5ps.conf.zh_TW: OK /etc/bg5ps.conf.zh_TW.Big5: OK
|
Here is just an idea. There are many tools for system integrity verification, which can be used flexibly.