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


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.).



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

checkroot: verify package signatures

Elmar Stellnberger's picture

rpm --verify -a will detect file system errors but may not reaveal traces of an intruder/cracker (use checkroot for this:


Anonymous's picture

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

diff with installed file

Tom H's picture

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.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState