Tech Tip: Determining What's Been Changed on RPM Based Systems

June 25th, 2009 by Vijay Avarachen in

Your rating: None Average: 4.2 (12 votes)

As a consultant, I am often faced with an unfamiliar Linux system (usually RHEL). I always find it useful to understand which files that shipped with rpm packages have been modified, since it's usually a good indicator of what customizations have been performed on the system. To determine the modified files, I simply run:

  % 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

The following is taken from the rpm man pages (Verify Options section):

  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

Using this trick, I can quickly determine what configuration files have been modified as well as any metadata modifications (ownership, link etc.).

__________________________


Special Magazine Offer -- Free Gift with Subscription
Receive a free digital copy of Linux Journal's System Administration Special Edition as well as instant online access to current and past issues. CLICK HERE for offer

Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Elmar Stellnberger's picture

checkroot: verify package signatures

On July 4th, 2009 Elmar Stellnberger (not verified) says:

rpm --verify -a will detect file system errors but may not reaveal traces of an intruder/cracker (use checkroot for this: http://wwwu.edu.uni-klu.ac.at/estellnb/checkroot/)

Anonymous's picture

Shorter

On June 25th, 2009 Anonymous (not verified) says:

Good tip, just one thing, why not shorten your command a bit:
rpm -Va --nomtime | less
Or am I missing something?

Tom H's picture

diff with installed file

On June 25th, 2009 Tom H (not verified) says:

Getting a diff with the original file (before user modification) is more difficult.

I've used rpm2cpio and cpio to extract files from the original rpm so I could get a diff of the line-by-line changes made.

http://www.brandonhutchinson.com/cpio_command.html

Post new comment

Please note that comments may not appear immediately, so there is no need to repost your comment.
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <i> <b>
  • Lines and paragraphs break automatically.

More information about formatting options

Newsletter

Each week Linux Journal editors will tell you what's hot in the world of Linux. You will receive late breaking news, technical tips and tricks, and links to in-depth stories featured on www.linuxjournal.com.
Sign up for our Email Newsletter

Tech Tip Videos

From the Magazine

December 2009, #188

If last month's Infrastrucuture issue was too "big" for you then try on this month's Embedded issue. Find out how to use Player for programming mobile robots, build a humidity controller for your root cellar, find out how to reduce the boot time of your embedded system, and if you're new to embedded systems find out the basics that go into one. You can also read about the Beagle Board, the Mesh Potato and a spate of other interestingly named items. And along with our regular columns don't miss our new monthly column: Economy Size Geek.







Read this issue