Wednesday, January 26, 2011

Don't Ask

(No, it was not me who made this necessary. Yes, we did reinstall the machine anyway.)
while read p; do
rpm -V $p > /dev/null && continue
echo "fixing $p's file ownership..."
while read x x u g x x x x n x; do
chown -h $u:$g $n
done < <(rpm -qlv $p)
done < <(rpm -qa)


  1. rpm --help | grep set
    --setperms set permissions of files in a package
    --setugids set user/group ownership of files in a package

    that wouldnt have helped you?

  2. Anonymous Coward26 January, 2011 15:11

    I like your script, it is ingenius -- but maybe this would have been sufficien :)
    for p in $(rpm -qa); do rpm --setperms $p; done
    for p in $(rpm -qa); do rpm --setugids $p; done

  3. Hehe, you know, I never stop learning about these things. Next time (let's hope this never happens) I'll read the manpage first... ;)