Search code examples
md5sum

Get the md5 hash on all files recursively


I am trying to get the MD5 from all files on a server on a daily basis and store them on a server like this

ssh server01 'md5sum /* 2>&1 | grep -v ": Is a directory" | grep -v "Permission denied"   ' > /home/serveradmin/md5current/server01.log

My problem is how can I do this recursively from the root / ?

I tried this as well but got an error

bash: /usr/bin/md5sum: Argument list too long

 ssh -p 9919 server01 'shopt -s globstar; md5sum "$1"/**  2>&1 | grep -v ": Is a directory" | grep -v "Permission denied"   ' > /home/serveradmin/md5current/server01.log

Any idea on how I can get the md5sum for these?


Solution

  • Something along:

    ssh server01 'find . -type f -readable -exec md5sum {} +'