技术提示:确定基于 RPM 的系统上已更改的内容
发布于 2009 年 6 月 25 日
作为一名顾问,我经常面对陌生的 Linux 系统(通常是 RHEL)。我总是觉得了解哪些随 rpm 包提供的文件已被修改很有用,因为它通常可以很好地指示系统上已执行哪些自定义操作。为了确定修改过的文件,我只需运行
% rpm -qa | xargs rpm --verify --nomtime | less # Sample output: missing /usr/local/src .M...... /bin/ping6 .M...... /usr/bin/chage .M...... /usr/bin/gpasswd ....L... c /etc/pam.d/system-auth .M...... /usr/bin/chfn .M...... /usr/bin/chsh S.5..... c /etc/rc.d/rc.local S.5..... c /etc/sysctl.conf S.5..... c /etc/ssh/sshd_config S.5..... c /etc/updatedb.conf
以下内容摘自 rpm 手册页(验证选项部分)
c %config configuration file.
d %doc documentation file.
g %ghost file (i.e. the file contents are not
included in the package payload).
l %license license file.
r %readme readme file.
S file Size differs
M Mode differs (includes permissions and file type)
5 MD5 sum differs
D Device major/minor number mismatch
L readLink(2) path mismatch
U User ownership differs
G Group ownership differs
T mTime differs
使用此技巧,我可以快速确定哪些配置文件已被修改以及任何元数据修改(所有权、链接等)。
