[CentOS] chown command goof up

Ross S. W. Walker rwalker at medallion.com
Tue Feb 13 01:08:56 UTC 2007


> -----Original Message-----
> From: David Woyciesjes [mailto:david.woyciesjes at yale.edu] 
> Sent: Monday, February 12, 2007 7:09 PM
> To: CentOS mailing list; Ross S. W. Walker
> Cc: CentOS mailing list
> Subject: RE: [CentOS] chown command goof up
> 
> Quoting "Ross S. W. Walker" <rwalker at medallion.com>:
> 
> >
> > Yup, just popt aliases, found in /usr/lib/rpm/rpmpopt-4.3.3
> >
> > rpm     alias --setperms -q --qf '[\[ -L %{FILENAMES:shescape} \] ||
> > chmod %7.7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \
> >                    --pipe "grep -v \(none\) | sed 's/chmod 
> .../chmod /'
> > | sh" \
> >         --POPTdesc=$"set permissions of files in a package"
> >
> > rpm     alias --setugids -q --qf \
> >         '[ch %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape}
> > %{FILENAMES:shescape}\n]' \
> >         --pipe "(echo 'ch() { chown -- \"$1\" \"$3\";chgrp -- \"$2\"
> > \"$3\"; }';grep -v \(none\))|sh" \
> >         --POPTdesc=$"set user/group ownership of files in a package"
> 
>    So if I'm following this right, then I just need to run 
> rpm --setugids `rpm
> -qa` as root, from /, and this should set the owner & groups 
> on all files,  as
> appropriate? Except for of course the files in /home?
>     As for my original plan, I saw krename in yum. At first 
> glance, that looks
> like it should do what I wanted. Anyone have experience with it?

Not sure what krename does, but yes an rpm --setugids `rpm -qa` and an
rpm --setperms `rpm -qa` will reset all file perms and ownership for all
files managed under RPM.

I gave a simple awk command to reset the perms in /home in an earlier
post, basically using awk to parse the passwd fields and then issuing a
shell statement with them.

-Ross

______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.




More information about the CentOS mailing list