GrepBoard/Manuals
605 manuals ·

Verify installed files against packages: debsums and rpm -V

·Tested on Ubuntu 24.04 · debsums 3.0.2.1 · Rocky Linux 9 · rpm 4.16.1.3 (Docker) · 2026-10·Test scope ↓·7 steps

Check packaged files with debsums or dpkg --verify on Ubuntu and rpm -V on Rocky 9. A changed binary, config file and deleted file show what each reports.

To find out whether files installed from a package were changed later, compare them with the checksums the package manager recorded at install time. Ubuntu has debsums (extra package) and dpkg --verify (built in); Rocky has rpm -V. In the same package (openssh-client / openssh-clients), three things were changed on purpose:

  • One byte appended to the binary /usr/bin/ssh-keyscan
  • One line added to the config file /etc/ssh/ssh_config
  • /usr/bin/ssh-copy-id deleted (on Rocky, /usr/bin/scp also set to mode 700)

[1] Install debsums on Ubuntu and confirm the package is clean first. -s prints only problems.

console
$ sudo apt install debsums$ debsums -s openssh-client

Before the changes it printed nothing and exited 0.

[2] Check again after the changes. Config files are skipped by default, so only the binary and the deletion show up:

console
$ debsums -s openssh-clientdebsums: missing file /usr/bin/ssh-copy-id (from openssh-client package)debsums: changed file /usr/bin/ssh-keyscan (from openssh-client package)

The exit code was 2. Per the man page, 2 means changed or missing files and 1 means a package name that is not installed. Use that in scripts.

[3] Add -a to include config files, or -e for config files only. -c prints just the changed file names to stdout.

console
$ debsums -a -s openssh-clientdebsums: missing file /usr/bin/ssh-copy-id (from openssh-client package)debsums: changed file /usr/bin/ssh-keyscan (from openssh-client package)debsums: changed file /etc/ssh/ssh_config (from openssh-client package)
console
$ debsums -ce openssh-client/etc/ssh/ssh_config

Admins are expected to edit config files, so review those separately from binary changes.

[4] Without debsums, use dpkg --verify. Its output uses the rpm format, and c marks config files.

console
$ dpkg --verify openssh-client??5?????? c /etc/ssh/ssh_configmissing     /usr/bin/ssh-copy-id??5??????   /usr/bin/ssh-keyscanmissing     /usr/share/doc/openssh-client/NEWS.Debian.gz…

5 means the checksum differs, ? means the check was not performed; as the dpkg man page says, only the content checksum is actually checked today. The 20 missing lines under /usr/share/doc/ and /usr/share/man/ exist because the Docker ubuntu image is configured to skip docs and man pages; a regular server will not show them. Note that this command exited 0 even with changed files. For scripted checks, count output lines or use the debsums exit code.

[5] On Rocky 9, use rpm -V. Before the changes it printed nothing; afterwards (exit code 1):

console
$ rpm -V openssh-clientsS.5....T.  c /etc/ssh/ssh_config.M.......    /usr/bin/scpmissing     /usr/bin/ssh-copy-idS.5....T.    /usr/bin/ssh-keyscan
LetterMeaning (rpm man page)In this test
SSize differsLine added, byte appended
MMode differs (permissions, type)chmod 700 scp
5Digest differsContent changed
TmTime differsContent changed
cConfig file (%config)ssh_config
.Test passed

rpm -qc openssh-clients lists a package's config files. If many files differ only in time, --nomtime drops the T check.

[6] Decide how to act on each result.

OutputAction
Only config files (c) changedMatch against your change records
5 on binaries or librariesFind out who changed them, then reinstall (sudo apt install --reinstall <pkg>, sudo dnf reinstall <pkg>)
missingConfirm it was an accident, then reinstall
M onlyRestore package permissions (on Rocky, rpm --setperms <pkg>)

How a reinstall treats a modified config file differs by package and tool, so copy the file from /etc first (reinstalls were not tested here).

[7] Know the limits as a security check. Both tools compare against the package database on the same system. The debsums man page describes it as a way to find admin modifications or media errors and of limited use as a security tool; the dpkg man page also says --verify is an integrity check, not a security verification. If you suspect an intrusion, check from clean boot media or use a dedicated integrity tool. For auditing setuid files, see find setuid files.

#debsums#dpkg-verify#rpm-verify#integrity#security