I am using RPM for file verification. What I do is run

rpm -Va

to get a list of files that have been changed. Then I run

rpm -qf 

to get the package name the file belongs to. Finally I run

rpm --setperms <pkgname>

This runs without error but does not seem to do its job as when I kickoff a new verification it returns the same list of files. Any reasons/caveats as to why this may not always work as intended?


Without details on what is failing, who knows, as some of the verifications will always fail and can never be fixed, if for example /etc/aliases has been modified to point root mail elsewhere:

% rpm -qf /etc/aliases
% rpm -V setup
S.5....T.  c /etc/aliases

In this case the file size differs (which a --setperms would do nothing to fix), the digest differs (again, --setperms is unrelated), and the mtime differs, which yet again --setperms will not do anything for.

However, permissions certainly can be broken and fixed with --setperms.

% sudo chmod 7001 /etc/aliases
% ls -l /etc/aliases
---S--S--t. 1 root root 1542 Aug  1  2014 /etc/aliases
% rpm -V setup
SM?....T.  c /etc/aliases
% sudo rpm --setperms setup
% rpm -V setup             
S.5....T.  c /etc/aliases
% ls -l /etc/aliases       
-rw-r--r--. 1 root root 1542 Aug  1  2014 /etc/aliases

Note the second column for "mode", and how the digest check failed given that the permissions were pooched.

(A wrapper around rpm -V might be handy, to verbosify this quite cryptic output...)

  • OK. After looking at most of the failed files, they were mostly the size, digest or date/time. So that makes sense. Thank you. – user53029 Oct 5 '15 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.