How to verify installed Debian software packages against MD5 checksumOn the Debian/Ubuntu system, you can use the debsums tool to verify the MD5 and. If you want to know about the debsums package before installation, you can use APT-CACHE, just like this:
apt-cache search debsums
Next, use the apt command to install it, as shown below:
sudo apt install debsums
Now you can learn how to use the debsums tool to verify the MD5 sum of installed software packages.
Note: sudo is used in all the commands below, because normal users may not have the permission to read some files.
In addition, the output from the debsums command shows the file location on the left and the inspection result on the right. You will get three possible results, including:
- ·OKDD indicates that the MD5 value of a file is good.
- ·FAILEDDD indicates that the MD5 of a file does not match.
- · REPLACEDDD indicates that a specific file has been replaced by a file from another software package.
If you do not need any options for running, debsums will verify each file on the system against the conventional md5sum file, scan the file system, find MD5 and
- /Usr/bin/a11y-profile-manager-indicatorOK
- /Usr/share/doc/a11y-profile-manager-indicator/copyrightOK
- /Usr/share/man/man1/a11y-profile-manager-indicator.1.gzOK
- /Usr/share/accounts/providers/facebook. providerOK
- /Usr/share/accounts/qml-plugins/facebook/Main. qmlOK
- /Usr/share/accounts/services/facebook-microblog.serviceOK
- /Usr/share/accounts/services/facebook-sharing.serviceOK
- /Usr/share/doc/account-plugin-facebook/copyrightOK
- /Usr/share/accounts/providers/flickr. providerOK
- /Usr/share/accounts/qml-plugins/flickr/Main. qmlOK
- /Usr/share/accounts/services/flickr-microblog.serviceOK
- /Usr/share/accounts/services/flickr-sharing.serviceOK
- /Usr/share/doc/account-plugin-flickr/copyrightOK
- /Usr/share/accounts/providers/google. providerOK
- /Usr/share/accounts/qml-plugins/google/Main. qmlOK
- /Usr/share/accounts/services/google-drive.serviceOK
- /Usr/share/accounts/services/google-im.serviceOK
- /Usr/share/accounts/services/picasa. serviceOK
- /Usr/share/doc/account-plugin-google/copyrightOK
- /Lib/systemd/system/accounts-daemon.serviceOK
- /Usr/lib/accountsservice/accounts-daemonOK
- /Usr/share/dbus-1/interfaces/org. freedesktop. Accounts. User. xmlOK
- /Usr/share/dbus-1/interfaces/org. freedesktop. Accounts. xmlOK
- /Usr/share/dbus-1/system-services/org. freedesktop. Accounts. serviceOK
- /Usr/share/doc/accountsservice/READMEOK
- /Usr/share/doc/accountsservice/TODOOK
- ....
To verify each file and configuration file of each software package and find any changes, add the-a or -- all option:
sudo debsums --all
Verify the MD5 and:
- /Usr/bin/a11y-profile-manager-indicatorOK
- /Usr/share/doc/a11y-profile-manager-indicator/copyrightOK
- /Usr/share/man/man1/a11y-profile-manager-indicator.1.gzOK
- /Etc/xdg/autostart/a11y-profile-manager-indicator-autostart.desktopOK
- /Usr/share/accounts/providers/facebook. providerOK
- /Usr/share/accounts/qml-plugins/facebook/Main. qmlOK
- /Usr/share/accounts/services/facebook-microblog.serviceOK
- /Usr/share/accounts/services/facebook-sharing.serviceOK
- /Usr/share/doc/account-plugin-facebook/copyrightOK
- /Etc/signon-ui/webkit-options.d/www.facebook.com. confOK
- /Usr/share/accounts/providers/flickr. providerOK
- /Usr/share/accounts/qml-plugins/flickr/Main. qmlOK
- /Usr/share/accounts/services/flickr-microblog.serviceOK
- /Usr/share/accounts/services/flickr-sharing.serviceOK
- /Usr/share/doc/account-plugin-flickr/copyrightOK
- /Etc/signon-ui/webkit-options.d/login.yahoo.com. confOK
- /Usr/share/accounts/providers/google. providerOK
- /Usr/share/accounts/qml-plugins/google/Main. qmlOK
- /Usr/share/accounts/services/google-drive.serviceOK
- /Usr/share/accounts/services/google-im.serviceOK
- /Usr/share/accounts/services/picasa. serviceOK
- /Usr/share/doc/account-plugin-google/copyrightOK
- ...
It is also possible to verify only the configuration file, excluding all other files of the software package. To do this, you only need to use the-e or -- config options:
sudo debsums --config
Verify only the MD5 and:
- /Etc/xdg/autostart/a11y-profile-manager-indicator-autostart.desktopOK
- /Etc/signon-ui/webkit-options.d/www.facebook.com. confOK
- /Etc/signon-ui/webkit-options.d/login.yahoo.com. confOK
- /Etc/signon-ui/webkit-options.d/accounts.google.com. confOK
- /Etc/dbus-1/system. d/org. freedesktop. Accounts. confOK
- /Etc/acpi/asus-keyboard-backlight.shOK
- /Etc/acpi/events/asus-keyboard-backlight-downOK
- /Etc/acpi/ibm-wireless.shOK
- /Etc/acpi/events/tosh-wirelessOK
- /Etc/acpi/asus-wireless.shOK
- /Etc/acpi/events/lenovo-undockOK
- /Etc/default/acpi-supportOK
- /Etc/acpi/events/ibm-wirelessOK
- /Etc/acpi/events/asus-wireless-onOK
- /Etc/acpi/events/asus-wireless-offOK
- /Etc/acpi/tosh-wireless.shOK
- /Etc/acpi/events/asus-keyboard-backlight-upOK
- /Etc/acpi/events/thinkpad-cmosOK
- /Etc/acpi/undock. shOK
- /Etc/acpi/events/powerbtnOK
- /Etc/acpi/powerbtn. shOK
- /Etc/init. d/acpidOK
- /Etc/init/acpid. confOK
- /Etc/default/acpidOK
- ...
Next, if you want to display only changed files in the debsums output, use the-c or -- changed option. I did not find any changed files in my system.
sudo debsums --changed
The next command outputs a file without md5sum information. Here we use the-l and -- list-missing options. On my system, this command does not display any files.
sudo debsums --list-missing
Now, you only need to specify the name to verify the md5 and:
sudo debsums apache2
Verify the MD5 and:
- /Lib/systemd/system/apache2.service. d/apache2-systemd.confOK
- /Usr/sbin/a2enmodOK
- /Usr/sbin/a2queryOK
- /Usr/sbin/apache2ctlOK
- /Usr/share/apache2/apache2-maintscript-helperOK
- /Usr/share/apache2/ask-for-passphraseOK
- /Usr/share/bash-completion/completions/a2enmodOK
- /Usr/share/doc/apache2/NEWS.Debian.gz OK
- /Usr/share/doc/apache2/PACKAGING.gz OK
- /Usr/share/doc/apache2/README.Debian.gz OK
- /Usr/share/doc/apache2/README. backtraceOK
- /Usr/share/doc/apache2/README. multiple-instances OK
- /Usr/share/doc/apache2/copyrightOK
- /Usr/share/doc/apache2/examples/apache2.monitOK
- /Usr/share/doc/apache2/examples/secondary-init-scriptOK
- /Usr/share/doc/apache2/examples/setup-instanceOK
- /Usr/share/lintian/overrides/apache2OK
- /Usr/share/man/man1/a2query.1.gz OK
- /Usr/share/man/man8/a2enconf.8.gz OK
- /Usr/share/man/man8/a2enmod.8.gz OK
- /Usr/share/man/man8/a2ensite.8.gz OK
- /Usr/share/man/man8/apache2ctl.8.gz OK
If you run debsums as an ordinary user without the sudo permission, you can use the -- ignore-permissions option to treat the permission error as a warning:
debsums --ignore-permissions
How to use the. Deb file to generate MD5 and?The-g option tells debsums to generate MD5 sum using deb content, where:
- · MissingDD command debsums uses deb to generate MD5 and for software packages that do not provide MD5 and.
- · The allDD command debsums ignores the disk and uses the sum existing in the deb file, or uses it to generate one if it does not exist.
- · The keepDD command debsums writes the extracted/generated and to the/var/lib/dpkg/info/package. md5sums file.
- · NocheckDD indicates that extracted/generated verification is not performed against installed software packages.
If you look at the directory/var/lib/dpkg/info/, you will see the md5sum of each file, as shown in:
cd /var/lib/dpkg/infols *.md5sums
List all MD5 and:
- A11y-profile-manager-indicator.md5sums
- Account-plugin-facebook.md5sums
- Account-plugin-flickr.md5sums
- Account-plugin-google.md5sums
- Accountsservice. md5sums
- Acl. md5sums
- Acpid. md5sums
- Acpi-support.md5sums
- Activity-log-manager.md5sums
- Adduser. md5sums
- Adium-theme-ubuntu.md5sums
- Adwaita-icon-theme.md5sums
- Aisleriot. md5sums
- Alsa-base.md5sums
- Alsa-utils.md5sums
- Anacron. md5sums
- Apache2-bin.md5sums
- Apache2-data.md5sums
- Apache2.md5sums
- Apache2-utils.md5sums
- Apg. md5sums
- Apparmor. md5sums
- App-install-data.md5sums
- App-install-data-partner.md5sums
- ...
Remember: using the-g option is the same as -- generate = missing. You can try to generate md5 and for The apache2 package by running the following command:
sudo debsums --generate=missing apache2
Because the apache2 package on my system already has md5 and, it will display the following output, which is the same as running $ sudo debsums apache2.
For more information about options and usage, see the debsums reference manual.
man debsums
This article describes how to verify installed Debian/Ubuntu software packages against MD5 checksum. To prevent installation and execution of corrupted binary or software package files on your system, it is necessary to verify the files on the file system against the information stored in the software package.
From: http:// OS .51cto.com/art/201610/519012.htm
Address: http://www.linuxprobe.com/check-debian-package-md5.html