Sponsored Content
Full Discussion: FileChecksum Monitoring
Operating Systems Linux FileChecksum Monitoring Post 303006534 by rbatte1 on Friday 3rd of November 2017 07:19:33 AM
Old 11-03-2017
Why not do an md5sum of all the files you are interested in to a single file? That way, just running md5sum -c checksums-file will do them all in one go. If you look at the file it creates, it will have the checksum and the examined filename in each record so you don't need to keep lots of separate single files and save you the worry of building/using an array.

For clarity, you can spread out your script if that helps, so saving the initial checksums:-
Code:
# However many files per line that makes sense to you, but nothing after the \ on each line

files_to_check="\
 /etc/passwd  /etc/shadow /security/access.conf \
 /etc/resolv.conf  /etc/sysconfig/network-scripts/* \
 /etc/fstab \
 /etc/httpd/httpd.conf \
 /anything/else/you/fancy \
"


md5sum $files_to_check > /var/lib/md5sums/critical.md5

Later you can just md5sum -c /var/lib/md5sums/critical.md5 and you get a nice report about the files previously listed.



I hope that this helps,
Robin
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

monitoring script

i have a unix batch written in c, dealing with really time-consuming database operations i want to write a ksh script to monitor its performance. which items i should monitor? do you have any suggestions? 1)cputime 2)swap area 3)pmem 4) 5) what else? (1 Reply)
Discussion started by: gfhgfnhhn
1 Replies

2. UNIX for Advanced & Expert Users

Bandwidth monitoring

Hi Gurus, Need to have a way to monitor Bandwidth utilization on Linux servers, running squid . Have worked on 3rd party monitoring tools like Bandwidth d, Nagios etc. But we are working to find out a way to monitor this through Sitescope, for which we need to find a file where the... (4 Replies)
Discussion started by: Crazy_murli
4 Replies

3. Programming

file monitoring

Hi i am am monitioring a file every 60 seconds and checking if the file has changed and if it has changed i append the changes to another file. i am able to monitior the change in file size but i have a problem copying the changes made in the file to another file. i am using lseek to seek the last... (1 Reply)
Discussion started by: problems
1 Replies

4. AIX

Monitoring

Hi Can any one helpe me in obtaining commands , which enables me to know the following : Monitor Storage Monitor RAM & CPU Utilization Monitor Power Supply Best wishes (1 Reply)
Discussion started by: magasem
1 Replies

5. Shell Programming and Scripting

Please help with monitoring stuff

Hi, I am trying to write a script to do monitoring kind of stuff, requirement - when a server is given a start it updates a file called server.log, I need to keep on grepping the word "Running" and as soon as it comes , script should be exited with the message , "Server came up... (2 Replies)
Discussion started by: sunilmenhdiratt
2 Replies

6. Infrastructure Monitoring

Remote Monitoring

Hi All, I am writing a tool which remotely monitors network devices and sends an alarm if the device does not respond just like an NMS. Can I use Threads module and invoke a simultaneous ping/snmpwalk to 100 or more devices and raise an alarm if any of the devices do no respond? Please... (1 Reply)
Discussion started by: gurukottur
1 Replies

7. Shell Programming and Scripting

Monitoring Script

Hello All, I have written a script which will grep for error codes in a file and if the count for the same is about 500 it will send and smpp alert. Here is my code. #!/bin/bash #########################################################################################################... (3 Replies)
Discussion started by: Siddheshk
3 Replies

8. Shell Programming and Scripting

Help with a monitoring script

I currently have a shellscript to check the size of a filesystem and email me if the size is over a certain percentage (80%). I have this script on crontab and executes the shell every 10 mins. I have the above in place on 8 servers. It so happens that a file system on one of the servers is... (1 Reply)
Discussion started by: goddevil
1 Replies

9. Shell Programming and Scripting

IOSTAT monitoring

Does anyone have an example of IOSTAT -eE in a script??????? Need to see the syntax in a script (4 Replies)
Discussion started by: walnutpony123
4 Replies

10. HP-UX

HP -UX 11.31 monitoring

Hi, i have joined newly as a hp-ux admin... previously worked in linux environment can anyone tell me how to monitor memory and cpu utilization in hpux?? hp-ux is not as flexible as linux as i understand... please help me out by giving the commands needed and way of troubleshooting if the... (12 Replies)
Discussion started by: Prasad@hp-ux
12 Replies
DEBSUMS(1)							   User Commands							DEBSUMS(1)

NAME
debsums - check the MD5 sums of installed Debian packages SYNOPSIS
debsums [options] [package|deb] ... DESCRIPTION
Verify installed Debian package files against MD5 checksum lists from /var/lib/dpkg/info/*.md5sums. debsums can generate checksum lists from deb archives for packages that don't include one. OPTIONS
-a, --all Also check configuration files (normally excluded). -e, --config Only check configuration files. -c, --changed Report changed file list to stdout (implies -s). -l, --list-missing List packages (or debs) which don't have an MD5 sums file. -s, --silent Only report errors. -m, --md5sums=file Read list of deb checksums from file. -r, --root=dir Root directory to check (default /). -d, --admindir=dir dpkg admin directory (default /var/lib/dpkg). -p, --deb-path=dir[:dir...] Directories in which to look for debs derived from the package name (default is the current directory). A useful value is /var/cache/apt/archives when using apt-get autoclean or not clearing the cache at all. The command: apt-get --reinstall -d install `debsums -l` may be used to populate the cache with any debs not already in the cache. Note: This doesn't work for CD-ROM and other local sources as packages are not copied to /var/cache. Simple file sources (all debs in a single directory) should be added to the -p list. -g, --generate=[missing|all][,keep[,nocheck]] Generate MD5 sums from deb contents. If the argument is a package name rather than a deb archive, the program will look for a deb named package_version_arch.deb in the directories given by the -p option. missing Generate MD5 sums from the deb for packages which don't provide one. all Ignore the on disk sums and use the one supplied in the deb, or generated from it if none exists. keep Write the extracted/generated sums to /var/lib/dpkg/info/package.md5sums. nocheck Implies keep; the extracted/generated sums are not checked against the installed package. For backward compatibility, the short option -g is equivalent to --generate=missing. --no-locale-purge Report missing locale files even if localepurge is configured. --no-prelink Report changed ELF files even if prelink is configured. --ignore-permissions Treat permission errors as warnings when running as non-root. --help --version Print help and version information. EXIT STATUS
debsums returns 0 on success, or a combination* of the following values on error: 1 A specified package or archive name was not installed, invalid or the installed version did not match the given archive. 2 Changed or missing package files, or checksum mismatch on an archive. 255 Invalid option. *If both of the first two conditions are true, the exit status will be 3. EXAMPLES
debsums foo bar Check the sums for installed packages foo and bar. debsums foo.deb bar.deb As above, using checksums from (or generated from) the archives. debsums -l List installed packages with no checksums. debsums -ca List changed package files from all installed packages with checksums. debsums -ce List changed configuration files. debsums -cagp /var/cache/apt/archives As above, using sums from cached debs where available. apt-get install --reinstall $(dpkg -S $(debsums -c) | cut -d : -f 1 | sort -u) Reinstalls packages with changed files. RESULTS
OK The file's md5sum is good. FAILED The file's md5sum does not match. REPLACED The file has been replaced by a file from a different package. NOTES
The default installation of debsums package sets the debconf boolean value debsums/apt-autogen to be "true". This will create /etc/apt/apt.conf.d/90debsums as: DPkg::Post-Invoke { "debsums --generate=nocheck -sp /var/cache/apt/archives"; }; by the postinst script (>=2.0.7). Every APT controlled package installation processes will execute this code fragment to generate the missing md5sums files from the binary packages. In order to create md5sums files for the already installed packages, you must run debsums_init once after the installation of debsums pack- age. SEE ALSO
md5sum(1), debsums_init(8) ENVIRONMENT
TMPDIR Directory for extracting information and contents from package archives (/tmp by default). CAVEATS
While in general the program may be run as a normal user, some packages contain files which are not globally readable so cannot be checked. Privileges are of course also required when generating sums with the keep option set. Files which have been replaced by another package may be erroneously reported as changed. debsums is intended primarily as a way of determining what installed files have been locally modified by the administrator or damaged by media errors and is of limited use as a security tool. If you are looking for an integrity checker that can run from safe media, do integrity checks on checksum databases and can be easily con- figured to run periodically to warn the admin of changes see other tools such as: aide, integrit, samhain, or tripwire. AUTHOR
Written by Brendan O'Dea <bod@debian.org>. Based on a program by Christoph Lameter <clameter@debian.org> and Petr Cech <cech@debian.org>. COPYRIGHT
Copyright (C) 2002 Brendan O'Dea <bod@debian.org> This is free software, licensed under the terms of the GNU General Public License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Debian 2007-11-29 DEBSUMS(1)
All times are GMT -4. The time now is 10:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy