Article Title: a simple system file verification method 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/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.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.